Upload
yahproj
View
14
Download
0
Tags:
Embed Size (px)
Citation preview
virtual techdaysCaching Enhancement in ASP.NET 4.0 Abhijit Jana Consultant, Microsoft http://abhijitjana.net
INDIA 9-11 February 2011
virtual techdaysSESSION AGENDA ASP.NET Caching Quick Tour Data / Object Caching Output Caching Page Caching Fragment Caching
INDIA 9-11 February 2011
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 techdaysASP.NET Caching Quick Tour Basic of ASP.NET Caching Caching is a technique where frequently used data and Web pages can stored temporarily. Its 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
INDIA 9-11 February 2011
virtual techdaysASP.NET Caching Quick Tour 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
INDIA 9-11 February 2011
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
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 22-24 November 2010
DEMO: New Object Caching API in ASP.NET 4.0 Abhijit Jana Consultant, Microsoft
virtual techdaysASP.NET Output Caching
INDIA 9-11 February 2011
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 techdaysResponse
INDIA 9-11 February 2011 ASP.NET Output Caching ContinueASPX Content
Request Response
Cached Content
Request Clients Web Server
virtual techdays1
INDIA 9-11 February 2011 ASP.NET Output Caching Deep Dive26 Page Class Instance Cached Version1. 2. Full Page Cache Partial Page Cache
7
3
ASPX Page Handler
ASP.NET Page
4
ASP.NET Engine
5
virtual techdays
INDIA 9-11 February 2011 ASP.NET Custom Output 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
Cache Provider
virtual techdays
INDIA 22-24 November 2010
DEMO: Creating Custom Output Cache Provider Abhijit Jana Consultant, Microsoft
virtual techdaysLimitations
INDIA 9-11 February 2011
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 Get Cache Provider
Database Cache Provider In Memory Cache ( Default Provider )
virtual techdays
INDIA 22-24 November 2010
DEMO: Dynamically Output Cache Provider Selection Abhijit Jana Consultant, Microsoft
virtual techdaysSummarize
INDIA 9-11 February 2011
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 techdaysResource Microsoft ASP.NET 4 Core Runtime for Web Developers Scaling Your Data Tier with Windows Server AppFabric http://msdn.microsoft.com/en-us/library/dd997357.aspx http://msdn.microsoft.com/enus/library/system.runtime.caching.memorycache.aspx
INDIA 9-11 February 2011
THANKS 9-11 February 2011
virtual techdaysThank [email protected] http://abhijitjana.net @AbhijitJana