Package org.hippoecm.hst.cache
Interface HstCache
-
public interface HstCache
HST Cache Interface for cache related activities. Abstraction around physical cache implementation.- Version:
- $Id$
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
CacheElement
createElement(Object key, Object content)
CacheElement
createUncacheableElement(Object key, Object content)
CacheElement
get(Object key)
CacheElement
get(Object key, Callable<? extends CacheElement> valueLoader)
int
getMaxSize()
int
getSize()
int
getTimeToIdleSeconds()
int
getTimeToLiveSeconds()
boolean
isKeyInCache(Object key)
void
put(CacheElement object)
boolean
remove(Object key)
-
-
-
Method Detail
-
createElement
CacheElement createElement(Object key, Object content)
-
createUncacheableElement
CacheElement createUncacheableElement(Object key, Object content)
- Returns:
- a
CacheElement
that is marked to be uncacheable
-
put
void put(CacheElement object)
-
get
CacheElement get(Object key)
Returns theCacheElement
forkey
andnull
otherwise. Please be aware that if the underlying cache such as ehcache BlockingCache sets a lock using thekey
, then typically you need to free this lock your self.- Parameters:
key
-- Returns:
- the
CacheElement
forkey
andnull
otherwise
-
get
CacheElement get(Object key, Callable<? extends CacheElement> valueLoader) throws Exception
- Parameters:
key
- thekey
to get from the cache or to put an object for in the cache when the cache does not yet containkey
valueLoader
- will be used to load the value forkey
if cache does not yet contain an object forkey
. The loaded value is put in the cache. ThevalueLoader
is not allowed to returnnull
but is allowed to return aCacheElement
withcontent
null.- Returns:
- the element from the cache, or the just retrieved and stored element through
valueloader
- Throws:
Exception
-
isKeyInCache
boolean isKeyInCache(Object key)
-
remove
boolean remove(Object key)
-
clear
void clear()
-
getTimeToIdleSeconds
int getTimeToIdleSeconds()
-
getTimeToLiveSeconds
int getTimeToLiveSeconds()
-
getSize
int getSize()
-
getMaxSize
int getMaxSize()
-
-