Share via

The Caching Application Block

The Enterprise Library Caching Application Block lets developers incorporate a local cache in their applications. It supports both an in-memory cache and, optionally, a backing store that can either be the database store or isolated storage. The Caching Application Block can be used without modification; it provides all the functionality needed to retrieve, add, and remove cached data. Configurable expiration and scavenging policies are also part of the block.


Caching Application Block functionality is built into .NET Framework 4.0; therefore the Enterprise Library Caching Application Block will be deprecated in releases after 5.0. You should consider using the .NET 4.0 System.Runtime.Caching classes instead of the Caching Application Block in future development.

The Enterprise Library Caching Application Block includes the following features:

  • You can use the graphical Enterprise Library configuration tools to manage configuration settings.
  • You can configure a persistent storage location, using either isolated storage or the Enterprise Library Data Access Application Block, whose state is synchronized with the in-memory cache.
  • Administrators can manage the configuration using Group Policy tools.
  • You can extend the block by creating custom expiration policies and storage locations.
  • You are assured that the block performs in a thread-safe manner.

This section includes the following topics that will help you to understand and use the Caching Application Block:

  • What Does the Caching Application Block Do? This topic provides a brief overview that will help you to understand what the block can do, and explains some of the concepts and features it incorporates. It also provides a simple example of the way that you can write code to use the block.
  • When Should I Use the Caching Application Block? This topic will help you to decide if the block is suitable for your requirements. It explains the benefits of using the block, and any alternative techniques you may consider. It also provides details of any limitations of the block that may affect your decision to use it.
  • Developing Applications Using the Caching Application Block. This topic first explains how to configure the Caching Application Block and add it to your application. It then explains how to select a backing store.
  • Key Scenarios. This section demonstrates how to use the block to perform typical caching operations.
  • Design of the Caching Application Block. This topic explains the decisions that went into designing the Caching Application Block and the rationale behind those decisions.
  • Extending and Modifying the Caching Application Block. This topic explains how to extend the block by adding your own backing store and your own expiration policies. It also explains how to modify it by changing the source code.
  • Deployment and Operations. This topic explains how to deploy and update the Caching Application Block assemblies.

More Information

For related information, see the following patterns & practices guides and documents:

For links to external caching providers, see the "More Information" section in The Caching Application Block on MSDN.