Cache items do not remain in the Windows Server AppFabric cache indefinitely. Either they are taken out from the cache explicitly (by invoking the Remove
method) or they are removed implicitly via expiration or eviction.
Simply put, expiration allows you to control the lifespan of cache items in the cache. By setting up cache expiration values, we tell Windows Server AppFabric cache to remove the cache item from the cache as soon as its lifespan is completed.
Note
It should be noted that cache items that have a lock handle active on them are not removed from the cache by Windows Server AppFabric. Cache items remain in the Windows Server AppFabric cache for as long as the lock handle is valid. However, cache items are removed from the Windows Server AppFabric cache as soon as the lock handle expires.
We have already seen how to explicitly remove cache items from the cache in Chapter 2, Getting Started with AppFabric Caching. In this recipe, we will focus on setting up...