Page Output Cache Provider for Windows Azure Cache Service (Preview)
The Windows Azure Cache output cache provider is an out-of-process storage mechanism for output cache data. This data is specifically for full HTTP responses (page output caching). The provider plugs into the new output cache provider extensibility point that was introduced in ASP.NET 4.
For a sample of output caching, see Cache Session State and Output Caching Sample.
|For this release, the output cache provider does not support Web Forms control-level output caching.|
The following list describes the benefits of storing output cache data out-of-process:
Developers can store larger amounts of output cache data because the only effective upper boundary on the quantity of data that can be cached is the cumulative amount of memory available to the cache.
Output cache data is not lost when a web application is recycled. Since the output cache data is stored externally outside of the IIS worker process, output cache data survives ASP.NET application restarts.
It can use compression through cache client properties.
To add the Output Cache provider to an ASP.NET project
First, configure a cache to use with the ASP.NET provider. For instructions, see Configure a Cache for Windows Azure Cache Service (Preview).
Use NuGet to add Cache support to your ASP.NET project in Visual Studio. For instructions, see Prepare Visual Studio for Windows Azure Cache Service (Preview) Client Application Development.
Important These steps require the latest NuGet Package Manager (version 2.6.40627.9000 or higher). To install the latest NuGet Package Manager, see NuGet Package Manager.
Remove any existing caching element that configures output caching. Do not remove the commented caching section that was added by the NuGet package.
In the web.config file, uncomment the caching section.
<!-- Windows Azure Caching output caching provider --> <!--Uncomment this section to use Windows Azure Caching for output caching--> <caching> <outputCache defaultProvider="AFCacheOutputCacheProvider"> <providers> <add name="AFCacheOutputCacheProvider" type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheOutputCache" /> </providers> </outputCache> </caching>
The following list provides optional configuration changes that affect the output cache provider.
Change the targeted named cache with the cacheName attribute of the add element.
Change the source of the cache client settings with the dataCacheClientName attribute of the add element. Set this attribute to the name of an existing dataCacheClient section in the web.config file.
Modify the behavior of the cache client by changing the settings in the associated dataCacheClient section. For example, enable compression with the isCompressionEnabled attribute.
Cache Client Configuration Settings for Windows Azure Cache Service (Preview). Note that the ASP.NET providers for Cache do not support binary or custom serialization types.
Change the settings for the output cache provider. For a list of available configuration options, see ASP.NET Page Output Cache Provider Configuration Settings for Windows Azure Cache Service (Preview).
In This Section