Adding a New Expiration Policy

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.

The Caching Application Block lets you add your own expiration policies. It does this by building new classes that implement the following interfaces:

  • ICacheItemExpiration. This interface lets developers implement their own expiration schema. It is the interface to an application-defined rule governing how and when a CacheItem object can expire.
  • ICacheItemRefreshAction. This interface refreshes an expired cache item.

The ICacheItemRefreshAction interface defines the contract that must be implemented to create an object that refreshes an expired item from the cache. The implementing class must be serializable. When implementing this interface, make sure that it maintains only the required amount of state about its environment. Because all portions of the environment will also be serialized, maintaining too much state can cause a huge object graph.

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.