org.nees.util.cache
Class CachingStrategy
java.lang.Object
org.nees.util.cache.CachingStrategy
- Direct Known Subclasses:
- ObjectCountingCachingStrategy, SimpleCachingStrategy
- public abstract class CachingStrategy
- extends java.lang.Object
CachingStrategies negotiate access to an expensive underlying
resource through a single accessor method, get(). The strategy can
fetch objects from an underlying resource which implements the
Cacheable interface, and can also manage a Cache of objects so as
to reduce usage of the underlying resource.
- See Also:
Cacheable,
Cache
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CachingStrategy
public CachingStrategy(Cache cache,
Cacheable cacheable)
- Parameters:
cache - the cachecacheable - the cacheable resources
CachingStrategy
public CachingStrategy()
setCacheable
public void setCacheable(Cacheable c)
getCacheable
public Cacheable getCacheable()
setCache
public void setCache(Cache c)
getCache
public Cache getCache()
get
public abstract java.lang.Object get(java.lang.Object key)
throws java.lang.Exception
- Get an object by key. Override this to provide specific
caching behavior.
- Parameters:
key - the key
- Returns:
- the associated object
- Throws:
java.lang.Exception