Export (0) Print
Expand All

Design of the Scavenging Process

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's scavenging process is performed by the BackgroundScheduler object. It checks the cache every time an item is added to see if the number of items in the cache has reached a predetermined limit. You use the Configuration Console to set this limit when you configure an instance of a cache manager. You also set how many items are removed from the cache after scavenging begins.

When an item is added to the cache, it can be given one of four priority settings: Low, Normal, High, or Not Removable. The BackgroundScheduler object determines which items should be scavenged by doing a major sort based on priority and a minor sort based on the last time the item was accessed. For example, an item with a Low priority that has just been used will be scavenged before something with a High priority that has not been accessed for three years. The default value is Normal.

The NotRemoveable priority is used when you want an item to remain in the cache until it expires. However, the cache should not be used as the only location where an item of data exists. A cache should be used to improve performance; it should not be used as a form of permanent storage.

Unlike the expiration process, the scavenging process performs marking and sweeping in a single pass. For more information about marking and sweeping, see Design of the Expiration Process.

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.
Show:
© 2014 Microsoft