Presentation is loading. Please wait.

Presentation is loading. Please wait.

Virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft

Similar presentations


Presentation on theme: "Virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft"— Presentation transcript:

1 virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft http://abhijitjana.net

2  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

3  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

4  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

5 virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Data – Object Caching Request For Information Cached Data

6 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.

7 virtual techdays INDIA │ 22-24 November 2010 DEMO: New Object Caching API in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft

8 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

9 virtual techdays INDIA │ │ 9-11 February 2011 ASP.NET Output Caching Continue… ASPX Content Cached Content Web Server Clients Request Response Request Response

10 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 1 1 2 2 3 3 4 4 5 5 6 6 7 7

11 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

12 virtual techdays INDIA │ 22-24 November 2010 DEMO: Creating Custom Output Cache Provider Abhijit Jana │ Consultant, Microsoft

13 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.

14 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

15 virtual techdays INDIA │ 22-24 November 2010 DEMO: Dynamically Output Cache Provider Selection Abhijit Jana │ Consultant, Microsoft

16 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

17 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  http://msdn.microsoft.com/en-us/library/dd997357.aspx http://msdn.microsoft.com/en-us/library/dd997357.aspx  http://msdn.microsoft.com/en- us/library/system.runtime.caching.memorycache.aspx http://msdn.microsoft.com/en- us/library/system.runtime.caching.memorycache.aspx

18 virtual techdays THANKS │ 9-11 February 2011 abhijan@microsoft.com │ http://abhijitjana.net │ @AbhijitJana http://abhijitjana.net @AbhijitJana Thank You


Download ppt "Virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft"

Similar presentations


Ads by Google