Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Caching data

Reply
Thread Tools

Caching data

 
 
3P
Guest
Posts: n/a
 
      09-22-2009
I want to cache readonly data at application start and have it in cache
till application stops/restarts.
I can use static fields, Cache object or Application object.
Which is best? I've read that Application is for compatibility with ASP
and shouldn't be used for caching.
 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      09-23-2009
As said Mark it won't make a huge difference. Else what matters is not what
is the best practice but *why* it is the best practice.

One advantage of the cache object i can think of, is that it allows also to
handle the lifetime (see
http://msdn.microsoft.com/en-us/libr...ng.cache.aspx). In
your case it doesn't seem to matter so keep whatever is in use and works...
Hence perhaps this advice you saw...

In all cases it's likely better to hide this from your main app so that you
can change the implementation at will...

--
Patrice

"3P" <(E-Mail Removed)> a écrit dans le message de groupe de discussion :
op.u0oh67ojmsp0fz@mcs...
> I want to cache readonly data at application start and have it in cache
> till application stops/restarts.
> I can use static fields, Cache object or Application object.
> Which is best? I've read that Application is for compatibility with ASP
> and shouldn't be used for caching.



 
Reply With Quote
 
 
 
 
3P
Guest
Posts: n/a
 
      09-23-2009
Dnia 23-09-2009 o 12:42:13 Mark Rae [MVP] <(E-Mail Removed)>
napisa³(a):

> "3P" <(E-Mail Removed)> wrote in message newsp.u0oh67ojmsp0fz@mcs...
>
>> I want to cache readonly data at application start and have it in cache
>> till application stops/restarts.
>> I can use static fields, Cache object or Application object.
>> Which is best?

>
> Practically, there is very little difference...
>
>
>> I've read that Application is for compatibility with ASP and shouldn't
>> be used for caching.

>
> Where have you read that...?
>

http://support.microsoft.com/default...;en-us;Q312607

ASP.NET includes application state primarily for compatibility with
classic ASP so that it is easier to migrate existing applications to
ASP.NET. It is recommended that you store data in static members of the
application class instead of in the Application object. This increases
performance because you can access a static variable faster than you can
access an item in the Application dictionary.
 
Reply With Quote
 
3P
Guest
Posts: n/a
 
      09-23-2009
>> http://support.microsoft.com/default...;en-us;Q312607
>
> Last Review: January 21, 2004
> APPLIES TO
> Microsoft ASP.NET 1.1
> Microsoft ASP.NET 1.0
>

OK. But if it was for compatibility with ASP in ASP.NET 1.0 it's now for
compatibility with ASP.NET 1.0 in ASP.NET 2.0.

And this will be true always

"...you can access a static variable faster than you can access an item in
the Application dictionary."
 
Reply With Quote
 
3P
Guest
Posts: n/a
 
      09-24-2009
Dnia 24-09-2009 o 01:47:17 Mark Rae [MVP] <(E-Mail Removed)>
napisa³(a):

> "3P" <(E-Mail Removed)> wrote in message newsp.u0qeizq2msp0fz@mcs...
>
>>>> http://support.microsoft.com/default...;en-us;Q312607
>>>
>>> Last Review: January 21, 2004
>>> APPLIES TO
>>> Microsoft ASP.NET 1.1
>>> Microsoft ASP.NET 1.0
>>>

>> OK. But if it was for compatibility with ASP in ASP.NET 1.0 it's now
>> for compatibility with ASP.NET 1.0 in ASP.NET 2.0.

>
> Not true.
>
>
>> And this will be true always

>
> Again, not true.
>
>
>> "...you can access a static variable faster than you can access an item
>> in the Application dictionary."

>
> Once again, not true.
>

And what about boxing/unboxing?
 
Reply With Quote
 
3P
Guest
Posts: n/a
 
      09-24-2009
Dnia 24-09-2009 o 18:14:22 Mark Rae [MVP] <(E-Mail Removed)>
napisa³(a):

> Negligible


But it is slower and that's the point. You said it isn't.
 
Reply With Quote
 
3P
Guest
Posts: n/a
 
      09-24-2009
Dnia 24-09-2009 o 18:50:51 Mark Rae [MVP] <(E-Mail Removed)>
napisa³(a):

> "3P" <(E-Mail Removed)> wrote in message newsp.u0rsvdkgmsp0fz@mcs...
>
>>> Negligible

>>
>> But it is slower and that's the point. You said it isn't.

>
> I have never, not even once, used the word "slower" anywhere in this
> thread...
>
> For the record, I said:
>
> "Practically, there is very little difference..."
> "There really is *no* appreciable difference"
> "Negligible"
>

That's what I'm saying

I cited
> "...you can access a static variable faster than you can access an item
> in the Application dictionary."


And You said
> Once again, not true.


It is slower but it's neglibible. But IT IS slower.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable page caching without disabling caching of jpegs andstylesheets etc JimLad ASP .Net 3 01-21-2010 10:13 AM
data grid - data caching help nullref ASP .Net Web Controls 0 12-07-2005 04:15 PM
Fragment Caching inside page caching? Troy Simpson ASP .Net 0 01-19-2004 11:57 AM
Page and Data Caching in .Net Alex ASP .Net 1 10-16-2003 03:41 PM
trouble with caching or caching the trouble Hypo ASP .Net 6 08-01-2003 07:11 AM



Advertisments