net.sf.ehcache.constructs.blocking
Class UpdatingSelfPopulatingCache
public
class
UpdatingSelfPopulatingCache
extends SelfPopulatingCache
A
Cache backed cache that creates entries on demand.
Clients of the cache simply call it without needing knowledge of whether
the entry exists in the cache, or whether it needs updating before use.
Thread safety depends on the factory being used. The UpdatingCacheEntryFactory should be made
thread safe. In addition users of returned values should not modify their contents.
Version: $Id: UpdatingSelfPopulatingCache.java 191 2006-09-03 22:41:48Z gregluck $
Author: Greg Luck
Creates a SelfPopulatingCache.
Looks up an object.
If null, it creates it. If not null, it updates it. For performance this method should only be
used with
UpdatingCacheEntryFactory's
It is expected that
gets, which update as part of the get, might take considerable time. Access to the cache cannot be blocked
while that is happening. This method is therefore not synchronized. Mutexes are used for thread safety based on key
Parameters: key
Returns: a value
Throws: net.sf.ehcache.CacheException
public void refresh()
This method should not be used. Because elements are always updated before they are
returned, it makes no sense to refresh this cache.