Share via


Key Scenarios

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The latest Enterprise Library information can be found at the Enterprise Library site.

This section describes the most common situations developers must address when storing data in a cache. Each scenario explains the task, gives a real-world situation for the task, and includes code demonstrating how to use the Caching Application Block to complete the task. The scenarios are divided into two sections. The first section demonstrates the basic caching operations:

  • Adding Items to the Cache. This topic describes how to add an item to the cache using the Add method. It also lets you set the item's expiration policy (for the expiration process) and its priority (for the scavenging process).
  • Removing Items from the Cache. This topic describes how to remove an item from the cache using the Remove method.
  • Retrieving Items from the Cache. This topic describes how to obtain an item from the cache using the GetData method.
  • Flushing the Cache. This topic describes how to flush the cache, which empties it, using the Flush method.

The second section, Loading the Cache, demonstrates proactive and reactive loading.