Is Page.Cache shared between all sessions?

M

Max2006

Hi,

Is Page.Cache global and shared between all session? What would be the best
way to cache an object and share it btween all sessions?
I like to avoid Application object because it doesn't have Cache's
flexibilities.

Thank you,
Max
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Max2006 said:
Hi,

Is Page.Cache global and shared between all session?
Yes.

What would be the best
way to cache an object and share it btween all sessions?
I like to avoid Application object because it doesn't have Cache's
flexibilities.

Thank you,
Max
 
G

Guest

Yes,

Cache should be shared around sessions (not sure in a farm of servers).

If you want you can make a dummy test:
- Add a Page cache of 30 minutes that read a value from a table in
database
- Open an IE an Access the page (it should be cached).
- Modify that value from the DB
- Open another IE sessions and you will get the page without the labe
updated from the DB.

HTH
Braulio


/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------
 
S

Steven Cheng[MSFT]

Hi Max,

Yes, you Page.Cache is shared among all the sessions, actually Page.Cache
is just HttpContext.Cache which is a global storage available within the
entire ASP.NET application scope(AppDomain). And it is a good place to
store some global data since it also provide some cachepolicy to make cache
item expired(such as File based, Database based or timespan based ....)

http://www.codeproject.com/aspnet/exploresessionandcache.asp

Also, other means for share objects within application scope include:

** store object/data in database

** use a public class's static member variables to hold objects

static member variable is useful for simple data caching scenario and you
need to take care of the concurrent accessing and update of the data in
shared static members.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top