PC Review


Reply
Thread Tools Rate Thread

Caching data

 
 
3P
Guest
Posts: n/a
 
      22nd Sep 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
 
      23rd Sep 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...ing.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
 
      23rd Sep 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
 
      23rd Sep 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
 
      24th Sep 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
 
      24th Sep 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
 
      24th Sep 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
Rate This Thread
Rate This Thread:

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
Caching App Data Dave T Microsoft ASP .NET 1 12th Mar 2008 08:11 PM
ANN: New Article: Improving Data Access Performance with Data Caching Microsoft Dot NET Compact Framework 0 21st Sep 2007 05:14 PM
data caching m.posseth Microsoft VB .NET 2 22nd May 2005 01:14 PM
Caching data in a web app Mark Microsoft ASP .NET 3 30th Aug 2004 04:06 PM
Best for caching data Janaka Microsoft ASP .NET 0 3rd Feb 2004 05:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:59 PM.