473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Application state vs. Cache API

Hi,

I need to cache infrequently changed data used by the entire application.
Does anybody know whether using Application state
(Application["YourGlobalState"] = somevalue;) or the Cache API
(Cache.Insert) is more preferable?

Thanks a lot

Daniel
Nov 18 '05 #1
5 5294
The cache object is more flexible in the long run. You can set a
duration and a priority for the cached item, for instance.

--
Scott
http://www.OdeToCode.com

On Sat, 10 Jul 2004 05:32:46 +0200, "Daniel Walzenbach"
<da**********************@freudenberg.de> wrote:
Hi,

I need to cache infrequently changed data used by the entire application.
Does anybody know whether using Application state
(Application["YourGlobalState"] = somevalue;) or the Cache API
(Cache.Insert) is more preferable?

Thanks a lot

Daniel


Nov 18 '05 #2
The cache is good, but it is considered volatile. There is never any
guarantee that the data is there. The item may be removed when it expires or
some condition is met (something you explicitly set), or the runtime may
remove the item when memory gets low. In contrast, the application variables
are there for the duration of the applications life, unless explicitly
removed by you and it provides methods to synchronise access to the
varibales as well. (.Lock for example).

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:j5********************************@4ax.com...
The cache object is more flexible in the long run. You can set a
duration and a priority for the cached item, for instance.

--
Scott
http://www.OdeToCode.com

On Sat, 10 Jul 2004 05:32:46 +0200, "Daniel Walzenbach"
<da**********************@freudenberg.de> wrote:
Hi,

I need to cache infrequently changed data used by the entire application.
Does anybody know whether using Application state
(Application["YourGlobalState"] = somevalue;) or the Cache API
(Cache.Insert) is more preferable?

Thanks a lot

Daniel

Nov 18 '05 #3
Hi Daniel,

I think Scott's suggestion is reasonable since the ASP.NET's Cache Object
not only provide the share space across the whole application scope but
also provide many mechenism to control's lifecyle(the different kind of
dependences). Here are some tech articles on ASP.NET caching:

#ASP.NET Caching: Techniques and Best Practices
http://msdn.microsoft.com/library/en...hingtechniques
bestpract.asp?frame=true

#Using the ASP.NET Application Cache to Make Your Applications Scream
http://www.codeguru.com/columns/Expe...cle.php/c4231/

#Manage Detail Pages Across Multiple Platforms with Centralized Data Caching
http://msdn.microsoft.com/asp.net/de...n-us/dnaspp/ht
ml/cencachv3.asp

Hope also helpful.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
Nov 18 '05 #4
Thank you!

Daniel

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> schrieb im Newsbeitrag
news:Sk**************@cpmsftngxa06.phx.gbl...
Hi Daniel,

I think Scott's suggestion is reasonable since the ASP.NET's Cache Object
not only provide the share space across the whole application scope but
also provide many mechenism to control's lifecyle(the different kind of
dependences). Here are some tech articles on ASP.NET caching:

#ASP.NET Caching: Techniques and Best Practices
http://msdn.microsoft.com/library/en...hingtechniques bestpract.asp?frame=true

#Using the ASP.NET Application Cache to Make Your Applications Scream
http://www.codeguru.com/columns/Expe...cle.php/c4231/

#Manage Detail Pages Across Multiple Platforms with Centralized Data Caching http://msdn.microsoft.com/asp.net/de...n-us/dnaspp/ht ml/cencachv3.asp

Hope also helpful.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #5
True but as with all caching, one ALWAYS checks to see if the data is in the
cache and if not gets fresh data. So unless connection is iffy, this really
should be a concern.

Harry

"Paul Glavich [MVP - ASP.NET]" <gl**@aspalliance.com-NOSPAM> wrote in
message news:Oa**************@TK2MSFTNGP09.phx.gbl...
The cache is good, but it is considered volatile. There is never any
guarantee that the data is there. The item may be removed when it expires
or
some condition is met (something you explicitly set), or the runtime may
remove the item when memory gets low. In contrast, the application
variables
are there for the duration of the applications life, unless explicitly
removed by you and it provides methods to synchronise access to the
varibales as well. (.Lock for example).

--
- Paul Glavich
Microsoft MVP - ASP.NET
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:j5********************************@4ax.com...
The cache object is more flexible in the long run. You can set a
duration and a priority for the cached item, for instance.

--
Scott
http://www.OdeToCode.com

On Sat, 10 Jul 2004 05:32:46 +0200, "Daniel Walzenbach"
<da**********************@freudenberg.de> wrote:
>Hi,
>
>
>
>I need to cache infrequently changed data used by the entire
>application.
>Does anybody know whether using Application state
>(Application["YourGlobalState"] = somevalue;) or the Cache API
>(Cache.Insert) is more preferable?
>
>
>
>Thanks a lot
>
>
>
> Daniel
>


Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: BB | last post by:
Hello all, I might be missing something here, but am trying to understand the difference between using application-level variables--i.e. Application("MyVar")--and global variables--i.e. public...
1
by: [myfirstname] | last post by:
Hello I've seen several examples around the web where people put all the values in ConfigurationSettings.AppSettings into Application State variables in global.asax, like this: foreach...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
2
by: Vishwanathan Raman | last post by:
Well I am quite confused with the methods out there. I would like to understand if Cache is the best method to store freq acessed data over application state.Currently I have pbs with the...
6
by: Eric McVicker | last post by:
Session state has options to be inproc, state server or sql server. Why does Application state not allow for state server or sql server so the same Application state could be shared between...
6
by: spacehopper_man | last post by:
I'm considering ditching all use of Session state in favour of Application state. This is because - from what I can work out - it will be more memory efficient for me. I have three questions:...
3
by: lucius | last post by:
I would like to remove things from Application state if they are older than 15 minutes. How can I do that? Thanks.
2
by: =?Utf-8?B?Q2hhcmxpZQ==?= | last post by:
I have written an ASP.Net web application in C#. On Appplication_Start the code loads some data from the database into memory. It stores the data in Application State variables. The data is read...
7
by: Cramer | last post by:
In addition to Web.config, I have a few configuration values that I store in a sql server database. I would like to read them from the database only once per Application.Start (there is no need to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.