Your SlideShare is downloading. ×
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
●
...
Basics of ASP.NET Caching
●
Caching is a technique to save frequently
used data into into temporary location.
●
Improves a...
Output Caching
●
Output caching enable to store rendered
HTML.
●
@ OutputCache directive is used to cache.
●
OutputCache a...
Output Caching...
●
OutputCache attributes:
◦ VaryByContentEncoding ( Ex: text/plain , text/html )
◦ Location
●
Server ( O...
Fragment Caching
●
Partial-page caching can work through user
control caching and post-cache substitution.
●
A portion of ...
Application/Object Caching
●
The application cache provides a
programmatic way for you to store arbitrary
data in memory u...
System.Runtime.Caching
●
System.Web.Caching.Cache is used with help
of System.Web.dll
●
New API came with .NET 4.0 under
S...
Custom Cache Provider
●
Output Caching are in memory.
●
Functionality came with ASP.NET 4.0
●
Implements OutputCacheProvid...
Custom Cache Provider...
●
Output Caching are in memory.
●
Functionality came with ASP.NET 4.0
●
Implements OutputCachePro...
Cache Provider
Add Get Set Remove
CloudDB Files
Custom Cache Provider...
Other techniques
●
Profile Caching under web.config to be
consistent with different setting.
●
GlobalOutputCacheProviderNa...
Caching Consideration
●
Full page caching: If page contents changes
after certain interval.
●
Fragment caching: Some of pa...
Question and
Answer
Thank you
Upcoming SlideShare
Loading in...5
×

Asp.net caching

2,484

Published on

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.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,484
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Asp.net caching"

  1. 1. ASP.NET Caching Presenter: Vikash Kumar, Mindfire Solutions
  2. 2. 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
  3. 3. 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
  4. 4. 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)
  5. 5. 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 )
  6. 6. 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.
  7. 7. 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
  8. 8. 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.
  9. 9. 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).
  10. 10. 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
  11. 11. Cache Provider Add Get Set Remove CloudDB Files Custom Cache Provider...
  12. 12. 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
  13. 13. 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.
  14. 14. Question and Answer
  15. 15. Thank you

×