public class ExpirationCache<K,V>
This class implements a caching with a maximum lifetime after which the elements are removed.
Optionally the cache can also have a limited size, in which case the least recently used entry
will be removed when adding a new entry with the size at the specified limit.
For expiration a single thread is used, so try to be fast in processing the callbacks.
The cached entry is most probably a hash of some sort. This is why the get() method
is specified in this interface, to provide an easy and uniform way of retrieving the
data between all the implementations.
public void overwrite(K key,
Add a new value in the cache for the given key, overwriting if necessary the previous entry. This will prevent the old entry from expiring, so
callbackOnExpiry(Object, Object) will never be called for the entry that is forcefully removed.
Update the contents of the cache entry. The implementation is application-dependent.
Typically it involves filling an internal hash with some values from the database. But it
can do whatever operation here, even something that doesn't involve actually caching anything,
but just to execute a periodic task (cron style).