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

The lifecycle of Cache

Hi all:

I want to use System.Web.Caching.Cache in my web application, but I want to
know the lifecycle of Cache (depending on Page, Session or Application ...).
Thanks!

Enosh
Oct 14 '06 #1
2 2607
re:
I want to know the lifecycle of Cache (depending on Page, Session or Application ...).
One instance of the Cache class is created per application domain,
and it remains valid as long as the application domain remains active.

You can insert items in the Cache :

1. with a key dependency ( When a key dependency changes, the object becomes invalid
and is removed from the cache ). You can opt to have it replaced with a new key dependency.

2. with a file dependency ( When any dependency changes, the object becomes invalid
and is removed from the cache ). You can opt to have it replaced with a new dependency.

3. With a SQLDependency, based on a SQL Server table or query.
When the data changes, so does the cache.

4. with an absoluteExpiration time

5. with a slidingExpiration time

You can also set up a notification when the item is removed from the cache.

See :
http://msdn2.microsoft.com/en-us/library/4y13wyk9.aspx

http://msdn2.microsoft.com/en-us/lib...b.caching.aspx

http://msdn2.microsoft.com/en-us/lib...ing.cache.aspx

http://msdn2.microsoft.com/en-us/lib...ependency.aspx

For specific usage, see Cache Insert :
http://msdn2.microsoft.com/en-us/lib...he.insert.aspx

There's other types of caching, like Output Caching.
You can control its duration with the "Duration parameter :

<%@ OutputCache Duration="#ofseconds"

See :
http://msdn2.microsoft.com/en-us/library/hdxfb6cy.aspx

You can also use partial caching ( caching user controls, for example ):

See:
http://msdn2.microsoft.com/en-us/lib....duration.aspx
http://msdn2.microsoft.com/en-us/lib...attribute.aspx

As you can see, there's a number of answers to your question,
depending on the type of caching you perform.

Read the supplied links and decide which type of caching,
and for which duration, is the caching you want to implement.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Enosh Chang" <ch********@yahoo.com.twwrote in message
news:u5**************@TK2MSFTNGP04.phx.gbl...
Hi all:

I want to use System.Web.Caching.Cache in my web application, but I want to know the lifecycle of
Cache (depending on Page, Session or Application ...). Thanks!

Enosh

Oct 14 '06 #2
Juan's answer is good. Just thought I'd mention that the word you are
looking for is "scope", not "lifecycle".

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"Enosh Chang" <ch********@yahoo.com.twwrote in message
news:u5**************@TK2MSFTNGP04.phx.gbl...
Hi all:

I want to use System.Web.Caching.Cache in my web application, but I want
to know the lifecycle of Cache (depending on Page, Session or Application
...). Thanks!

Enosh

Oct 14 '06 #3

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

Similar topics

0
by: Epson Barnett | last post by:
I'm new to ASP.NET and have run across a problem several times while working on web apps. I often need to create content dynamically (based on an event) which contains dynamically created...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
2
by: Frankie | last post by:
I have a user control into which I insert a bunch of controls dynamically. I have it all working just fine - Everything is there on Postback, etc. I load this user control into a hosting ASPX...
2
by: Diffident | last post by:
Hello All, I have a question which is pertinent to Page's lifecycle. I declared a protected static object (global variable) whose value is set only once when the page is loaded. Will that...
0
by: multiformity | last post by:
I have had a lot of trouble finding any solid explinations of what methods/events are called during a page lifecycle in conjunction with a composite control. After some severe tinkering and...
1
by: =?Utf-8?B?QW5kZXJ3IE1pbGxlcg==?= | last post by:
Apologies for posting in this forum, I don't see a more appropriate group... I'm trying to understand the timeline for Window 2003 ending mainstream support. I have consulted the MS lifecycle...
2
by: Gary W. Smith | last post by:
I have a page that inherits from a base page that is currently overriding all of the On* events. For the most part I'm accomplishing everything I set out to do with the inheritance, but I wanted...
1
by: DotNetNewbie | last post by:
Hi, I am implement ajax in a web application, and I want to avoid having to go through the entire asp.net page lifecycle since I will be simply return back html/xml, and I have no need of the...
2
by: bsmith95610 | last post by:
Hello, I am trying to learn how the asp. Net lifecycle of a web page works. I am a jr. programmer and am just starting to learn C#. Does anyone know of any websites or tutorials that explain...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.