SALES: 1-800-867-1380
This topic has not yet been rated - Rate this topic

Output Cache Provider for Windows Azure Cache

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.

noteNote
For this release, the output cache provider does not support Web Forms control-level output caching.

Capabilities

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

  1. First, configure a cache to use with the ASP.NET provider. You can host Cache with a co-located topology or with a dedicated role.

  2. Use NuGet to add Cache support to your ASP.NET project in Visual Studio. For instructions, see How to: Prepare Visual Studio to Use In-Role Cache (Windows Azure Cache).

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

  3. Remove any existing caching element that configures output caching. Do not remove the commented caching section that was added by the NuGet package.

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

    <dataCacheClient name="default" isCompressionEnabled="true">
    
    For a list of available configuration options, see In-Role Cache Client Configuration Settings (Web.config). 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 Output Cache Provider Configuration Settings (Windows Azure Cache).

To use the provider with Shared Caching, see How to: Configure the ASP.NET Output Cache Provider (Windows Azure Shared Caching).

In This Section

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.