473,388 Members | 1,426 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,388 software developers and data experts.

cache question

I've read a couple of articles on cache and setting expiration etc.
What I can't find the answer to is - if you don't set an expiration for
your cache, what is the default? And when your cache does expire, how
do you catch this event? For example, if I have a datagrid which is
populated by cached data and the cached data expires, what happens when
I try to access that datagrid?
Any help would be much appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #1
6 1361
PJ
the cache will expire when the aspnet_wp is forced to recycle

when accessing cache data do something like this in a static method to
retrieve the data

string myCachedData = HttpContext.Current.WebCache("myCachedData");
if ( myCachedData == null )
{
// code to put the data in the cache
}
return myCachedData;

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:ue**************@TK2MSFTNGP12.phx.gbl...
I've read a couple of articles on cache and setting expiration etc.
What I can't find the answer to is - if you don't set an expiration for
your cache, what is the default? And when your cache does expire, how
do you catch this event? For example, if I have a datagrid which is
populated by cached data and the cached data expires, what happens when
I try to access that datagrid?
Any help would be much appreciated.
Cheers,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #2
What will cause aspnet_wp to recycle? Is it recycled when a session
times out?

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3
It is recycled when
a) an application level error occurs
b) the server is restarted (or IIS is restarted)
c) an application times out, meaning it hasn't been accessed in the time
out period
d) in IIS 6.0 all applications are recycled on a set time period (set in
the IIS manager). I beleive the default is 29 hours.
e) If you recompile the application, when ASP.NET notices the change, it
recycles the application
Ryan Gregg

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:uO*************@tk2msftngp13.phx.gbl...
What will cause aspnet_wp to recycle? Is it recycled when a session
times out?

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #4
PJ
And I believe it happens when you modify the machine.config or web.config as
well...

"Ryan Gregg" <rg****@wheatlandsystems.com> wrote in message
news:eh**************@TK2MSFTNGP12.phx.gbl...
It is recycled when
a) an application level error occurs
b) the server is restarted (or IIS is restarted)
c) an application times out, meaning it hasn't been accessed in the time out period
d) in IIS 6.0 all applications are recycled on a set time period (set in the IIS manager). I beleive the default is 29 hours.
e) If you recompile the application, when ASP.NET notices the change, it recycles the application
Ryan Gregg

"Mike P" <mr*@telcoelectronics.co.uk> wrote in message
news:uO*************@tk2msftngp13.phx.gbl...
What will cause aspnet_wp to recycle? Is it recycled when a session
times out?

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 17 '05 #5
So assigning something to the Cache is essentially the same as assigning
it to a Session variable (i.e. it expires on timeout and is particular
to the specific user and not the application)?
Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #6
I've done a few tests and found that Cache is Application level and not
Session level, which I would think means that it can only be used for
storing global variables.
Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #7

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

Similar topics

9
by: Joe Fallon | last post by:
If I add an instance of an object to the Cache what is returned when I request the item from the cache? Is it a clone of the object or is it a reference to the object? I want to know because I...
5
by: Darrel | last post by:
I thought this warranted a new thread. Yesterday I asked about access relatively static content...is it better to read from the DB, or just grab a text file. It was suggested that I use the DB...
1
by: Brian Linden | last post by:
I cache a ton of stuff, and my application works great....but...... When I am stress testing it I'll get the "Object reference not set to an instance of an object" every once in a while... It...
3
by: Sally Sally | last post by:
I have a very basic question on the two parameters shared buffers and effective cache size. I have read articles on what each is about etc. But I still think I don't quite grasp what these settings...
2
by: Don Kelloway | last post by:
I'm a first-time user with PostgreSQL so please forgive my ignorance. I've purchased (and read) Practical PostgreSQL (O'Reilly) and PostgreSQL Essential Reference (New Riders). So far, so good. ...
2
by: LeAnne | last post by:
My question is to do with scalability and the location for storate of cache, session, viewstate and application data. Application - Data is stored in memory (in process) Session - Data is stored...
5
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist);...
5
by: J055 | last post by:
Hi The following code works on my develeopment machine using the VS web server. When I run the application on 2 other Windows 2003/IIS 6 servers no caching seems to take place at all. Can...
10
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've been trying to migrate our asp.net apps off older, underpowered hardware to newer, bigger boxes but when we do, we see our databases start to melt. When I started to look into it,...
2
by: Ken Fine | last post by:
I have a question about ASP.NET output caching. I want to use screen scraping as a temporary hack to pull in some complex Classic ASP-rendered content into some ASP.NET pages: protected String...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.