of 24 /24
Microsoft ASP.NET: An Overview of Caching

Microsoft ASP.NET: An Overview of Caching. 2 Overview Introduction to ASP.NET caching Output caching Data caching Difference between Data Caching

Embed Size (px)

Text of Microsoft ASP.NET: An Overview of Caching. 2 Overview Introduction to ASP.NET caching Output...

Microsoft ASP.NET: An Overview of Caching

Microsoft ASP.NET: An Overview of Caching

2OverviewIntroduction to ASP.NET cachingOutput cachingData cachingDifference between Data Caching and Output Caching3What is CachingCache = secret storeArmies: cache weaponsSquirrels: cache nutsComputers: cache dataBenefits of caching data:ReuseProcess once, reuse many timesFaster, cheaperCaching means temporary storage of data in memory that is highly-demanding and frequently used in order to accelerate performance and for quick access to various essential information.34Output CachingWhat is output [email protected] OutputCache directive and the cache objectOutput caching attributes: DurationLocationVaryByParamVaryByHeaderVaryByCustom5Output (or) Page CachingThis is the most simplest form of caching. caches the output of a page (or portions of it) so that content of page are not generated every time it is loaded. 6What Is Output Caching?Pages that use the output cache are executed one time, and the page results are cachedThe pre-executed page is then served to later requestsPerformance and scalability both benefitServer response times reducedCPU load reducedAppropriate caching of pages affects site performance dramatically [email protected] OutputCache Directive and the Cache [email protected] OutputCache declaratively controls caching behaviorFor .aspx, .asmx, or .ascx The cache object programmatically controls caching behavior

Is equivalent to:

[C#]Response.Cache.SetExpires(DateTime.Now.AddSeconds(600));Response.Cache.SetCacheability(HttpCacheability.Public);

8OutputCache Members: Duration and LocationDuration sets the time to cache the outputIn secondsRequiredLocation sets the location to cache the outputServer: The output is held in memory on the Web server and is used to satisfy requestsDownstream: A header is added to the response to indicate to proxy servers to cache the pageClient: A header is added to the response indicating to browsers to cache the pageAny: Output cache can be located on any of these locationsNone: No output caching is turned on for the item