Reloader for cached objects. A CacheReloader can be associated with an object in the cache using either ReloadableCache.put() or ReloadableCache.setReloader().
Normal cache operation is to check for entry expiration when get() is called. If the entry has no CacheReloader, get will remove expired entries and return null. This is usually taken as a signal for the calling program to build the item. But if the entry has a CacheReloader, the Cache.get() method will use it to rebuild expired items rather than returning null.
Related Topics
AsynchronousCacheReloader
Method Summary |
public |
Method Detail |
publicThis is the method used to rebuild objects for the cache. It is called whenever the cache detects that an item has expired and needs to be reloaded. An implementaion of this method should return the new object that will replace the expired object in the cache.Object
reload(String
cacheName,Object
key,Object
oldValue)
The method arguments are probably not necessary in most cases, but are here to allow you to implement a single CacheReloader that can be reused for multiple cached objects.