Page Output Cache Provider for Azure Managed Cache Service


Microsoft recommends all new developments use Azure Redis Cache. For current documentation and guidance on choosing an Azure Cache offering, see Which Azure Cache offering is right for me?

The Azure Managed Cache Service 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

  1. First, configure a cache to use with the ASP.NET provider.

  2. Use NuGet to add caching support to your ASP.NET project in Visual Studio.


    These steps require NuGet Package Manager version 2.6.40627.9000 or higher. To install the latest NuGet Package Manager, see NuGet Package Manager.

  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.

        <!-- Azure Caching output caching provider -->
        <!--Uncomment this section to use Azure Caching for output caching-->
          <outputCache defaultProvider="AFCacheOutputCacheProvider">
              <add name="AFCacheOutputCacheProvider" 
                type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache"
                applicationName="AFCacheOutputCache" />

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 Cache Client Configuration Settings for Azure Managed Cache Service. 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 Page Output Cache Provider Configuration Settings for Azure Managed Cache Service.

In This Section