In this recipe, we will cover the following topics:
We will examine how to implement a custom eviction algorithm for our cached objects. We will re-use the Ehcache library classes as the basis for our own eviction algorithm.
Eviction algorithms are used to determine when to evict (or simply eject) an element from the cache layer when a certain condition has been met (for example, its life duration).
Ehcache also provides built-in eviction algorithms that you can use. However, there may be scenarios where you will want to control how to eject cached objects, and may want your code to react upon specific ...