Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Web.HttpContext.Current.Cache information

Tags:

c#

asp.net

I would like to ask if System.Web.HttpContext.Current.Cache is per User like the Sessions or if it is per application. On which circumstances is nice to use Cache?.

like image 360
user1292656 Avatar asked Jan 30 '13 11:01

user1292656


1 Answers

HttpContext.Cache Property - MSDN

There is one instance of the Cache class per application domain. As a result, the Cache object that is returned by the Cache property is the Cache object for all requests in the application domain.

For your question.

On which circumstances is nice to use Cache?.

Keep that information in Cache which will be shared by multiple users and (usually) if its readonly. For example keeping lookup values in cache. You may see:

Caching Data in an ASP.NET Web Pages Site for Better Performance

like image 54
Habib Avatar answered Oct 02 '22 20:10

Habib