• Save
Asp.net caching
Upcoming SlideShare
Loading in...5
×
 

Asp.net caching

on

  • 2,547 views

Caching is a technique to save frequently used data into into temporary location. Improves application performance. Reduce a lot of server resources at peak times.

Caching is a technique to save frequently used data into into temporary location. Improves application performance. Reduce a lot of server resources at peak times.

Statistics

Views

Total Views
2,547
Views on SlideShare
2,543
Embed Views
4

Actions

Likes
1
Downloads
0
Comments
0

1 Embed 4

http://localhost 4

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Asp.net caching Asp.net caching Presentation Transcript

  • ASP.NET Caching Presenter: Vikash Kumar, Mindfire Solutions
  • Agenda ● Basics of ASP.NET Caching ● Types of Caching ● Output Caching ● Full Page Caching ● Partial (Fragment) Caching ● Application (Object) Caching ● System.Runtime.Caching ● Custom cache providers ● Some other caching techniques ● Caching consideration
  • Basics of ASP.NET Caching ● Caching is a technique to save frequently used data into into temporary location. ● Improves application performance. ● Reduce a lot of server resources at peak times. ● Types of Caching ◦ Output Caching ● Full Page Caching ● Partial (Fragment caching) ◦ Application (Object) caching
  • Output Caching ● Output caching enable to store rendered HTML. ● @ OutputCache directive is used to cache. ● OutputCache attributes: ◦ Duration (time duration in seconds) ◦ VaryByParam (Cache by parameters) ◦ VaryByControl (Cache by controls) ◦ VaryByHeader (Cache by header Ex: User-Agent) ◦ VaryByCustom (GetVaryByCustomString on Global.asax)
  • Output Caching... ● OutputCache attributes: ◦ VaryByContentEncoding ( Ex: text/plain , text/html ) ◦ Location ● Server ( Output is saved under Web server memory ) ● Downstream ( Header is added to response to cache on proxy server ) ● Client ( Header is added to response to cache on page level ) ● Any ( Could be stored on any location ) - Default ● None ( No caching is done )
  • Fragment Caching ● Partial-page caching can work through user control caching and post-cache substitution. ● A portion of the page get cached. ● Done through help of user controls or substitution controls like AdRotator ● Shared attribute is only available for user control for sharing cache across multiple pages.
  • Application/Object Caching ● The application cache provides a programmatic way for you to store arbitrary data in memory using key/value pairs. Using the application cache is like using application state. ● System.Web.Caching assembly ● Depends upon HttpContext ● Functions ◦ Cache.Insert ◦ Cache.Add
  • System.Runtime.Caching ● System.Web.Caching.Cache is used with help of System.Web.dll ● New API came with .NET 4.0 under System.Runtime.Caching.dll with System.Runtime.Caching ● It could be used in Win Forms, WPF etc without making reference to System.Web.dll ● The new API is based on in memory cache. ● Write once and can be used in different .NET technologies.
  • Custom Cache Provider ● Output Caching are in memory. ● Functionality came with ASP.NET 4.0 ● Implements OutputCacheProvider. ● Add(), Get(), Set(), Remove() functions are available for operation ● Through custom cache provider cache could be stored in File system, Cloud, database, memory. ● Helpful under scavenging process (removing of cache when server memory is getting low).
  • Custom Cache Provider... ● Output Caching are in memory. ● Functionality came with ASP.NET 4.0 ● Implements OutputCacheProvider. ● Add(), Get(), Set(), Remove() functions are available for operation ● Through custom cache provider cache could be stored in File system, Cloud, database, memory. ● Helpful under scavenging process (removing of cache when server memory is getting low). Cache Provider Add Get Set Remove DB Files
  • Cache Provider Add Get Set Remove CloudDB Files Custom Cache Provider...
  • Other techniques ● Profile Caching under web.config to be consistent with different setting. ● GlobalOutputCacheProviderName in Global.asax to change cache providers according to need. ● SQLCacheDependency has very limited support and also depends upon SQL configuration too. http://blogs.msdn.com/b/tolong/archive/2007/02/16/sql-cache-dependency.aspx http://www.codeproject.com/Articles/12335/Using-SqlDependency-for- data-change-events
  • Caching Consideration ● Full page caching: If page contents changes after certain interval. ● Fragment caching: Some of page contents remains static but others are frequently changes. ● Object caching: Data is accessed frequently and takes time to load up. ● Cache dependency: File, Directory or based on other cache entries. ● Sliding or Absolute: Sliding, if data is not changed frequently.
  • Question and Answer
  • Thank you