com.bea.p13n.cache
Interface CacheReloader

All Known Subinterfaces:
AsynchronousCacheReloader

public interface CacheReloader

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.

See Also
ReloadableCache

Method Summary
 Object reload(String cacheName, Object key, Object oldValue)
          This is the method used to rebuild objects for the cache.
 

Method Detail

reload

Object reload(String cacheName,
              Object key,
              Object oldValue)
This 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.

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.

Parameters
cacheName - the name of the cache that is requesting the reload
key - the name of the key that is to be reloaded
oldValue - the current (expired) value in the cache
Returns
the new value to be put in the cache. Returning null has the effect of causing the key to be removed from the cache.


Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.