virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft
ASP.NET Caching Quick Tour Data / Object Caching Output Caching Page Caching Fragment Caching New Object Caching Option System.Runtime.Caching Output Cache Provider in ASP.NET 4.0 Internals of Output Cache Provider Creating Custom Cache Providers Limitation Selecting Cache Provider on the fly virtual techdays INDIA │ 9-11 February 2011 S E S S I O N A G E N D A
Caching is a technique where frequently used data and Web pages can stored temporarily. It’s a great feature that reduces network latency and It can improve application's performance considerably. ASP.NET Caching Data / Object Caching Output Caching Page Output Caching Fragment Caching virtual techdays INDIA │ 9-11 February 2011 ASP.NET Caching Quick Tour Basic of ASP.NET Caching
ASP.NET Caching is Implemented as HTTPModule Cache Module Listens to all the incoming Request OutputCacheModule listens to ResolveRquestCache and UpdateRequestCache Based on the events modules returns the Cached HTML content or moving forward to Page Handler Cache can have Dependencies File based dependencies Time Based dependencies virtual techdays INDIA │ 9-11 February 2011 ASP.NET Caching Quick Tour BeginRequest Event AuthenticateRequest Event AuthorizeRequest Event ResolveRequestCache Event Map Request Handler AcquireRequestState Event
virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Data – Object Caching Request For Information Cached Data
virtual techdays INDIA │ │ 9-11 February 2011 New Object Caching API in ASP.NET 4.0 ASP.NET in-memory object cache (System.Web.Caching.Cache) with help of System.Web.dll Same Cache Object Can be used for Win Forms, WPF based application with reference of System.Web.dll .NET Framework 4 introduces a new assembly System.Runtime.Caching.dll The Assembly contains a new caching API in the System.Runtime.Caching namespace. The new API mainly based on concrete in-memory object cache implementation (System.Runtime.Caching.MemoryCache class). Win forms, WPF based application can use Caching with just help of System.Runtime.Caching.dll. So, no need to load System.web.dll for non web applications.
virtual techdays INDIA │ November 2010 DEMO: New Object Caching API in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft
virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Output Caching Caches rendered markup of an ASP.NET page Caches Complete Rendered Markup Caches Partial Markup Caching Substitution Output caching can be configured based on duration, params Cached version of the page can be sent in response without running the page MSIL
virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Output Caching Continue… ASPX Content Cached Content Web Server Clients Request Response Request Response
virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Output Caching – Deep Dive ASPX Page Handler ASP.NET Page ASP.NET Engine Page Class Instance Cached Version 1.Full Page Cache 2.Partial Page Cache 1.Full Page Cache 2.Partial Page Cache
virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Custom Output Cache Provider Cache Provider Output Caches Stored In Memory Extending ASP.NET Output Caching Custom Cache Provider Implements OutputCacheProvider Add(), Get(), Remove(), Set() Can be store File System, DB, In Memory, Cloud
virtual techdays INDIA │ November 2010 DEMO: Creating Custom Output Cache Provider Abhijit Jana │ Consultant, Microsoft
virtual techdays INDIA │ │ 9-11 February 2011 Limitations Supported File dependencies but no custom dependencies. Custom Cache providers only supports Absolute expiration. There is no supports for sliding expiration.
virtual techdays INDIA │ │ 9-11 February 2011 Selecting Cache Provider On the Fly If you have multiple Cache Provider you can select any of the at runtime based on your requirements. Can set default Provider. Disk Cache Provider Database Cache Provider In Memory Cache ( Default Provider ) Get Cache Provider
virtual techdays INDIA │ November 2010 DEMO: Dynamically Output Cache Provider Selection Abhijit Jana │ Consultant, Microsoft
virtual techdays INDIA │ │ 9-11 February 2011 Summarize Caching is a technique where frequently used data and Web pages can stored temporarily. ASP.NET having Data Caching and Output Caching with Cache Dependency .NET 4.0 Introduce new Object Caching for ASP.NET 4.0 Using System.Runtime.Caching Internal of Output Caching in ASP.NET Creating Custom Cache Provider using OutputCacheProvider Select Cache Provider on the Fly
virtual techdays INDIA │ 9-11 February 2011 Resource Microsoft ASP.NET 4 Core Runtime for Web Developers Microsoft ASP.NET 4 Core Runtime for Web Developers Scaling Your Data Tier with Windows Server AppFabric Scaling Your Data Tier with Windows Server AppFabric us/library/system.runtime.caching.memorycache.aspx us/library/system.runtime.caching.memorycache.aspx
virtual techdays THANKS │ 9-11 February 2011 │ Thank You