Output Cache Provider for Windows Azure Caching
The Windows Azure 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 Caching 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 Windows Azure cache cluster.
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
Use NuGet to add Caching support to your ASP.NET project in Visual Studio. For instructions, see How to: Prepare Visual Studio to Use Caching for Windows Azure.
Important These steps require the latest NuGet Package Manager (version 2.1.31002.9028 or higher). To install the latest NuGet Package Manager, go to http://go.microsoft.com/fwlink/?LinkId=240311.
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 --> <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.
Windows Azure Caching Client Configuration Settings (Web.config). Note that the ASP.NET providers for Caching 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 Output Cache Provider Configuration Settings (Windows Azure Caching).
To use the provider with Shared Caching, see How to: Configure the ASP.NET Output Cache Provider (Windows Azure Shared Caching).
In This Section