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
Modifier and TypeMethodDescriptionvoid
clear()
createElement
(Object key, Object content) createUncacheableElement
(Object key, Object content) get
(Object key, Callable<? extends CacheElement> valueLoader) Returns cached object associated with thekey
in the cache, obtaining that value from thevalueLoader
if necessary.int
int
getSize()
int
int
boolean
isKeyInCache
(Object key) void
put
(CacheElement object) boolean
-
Method Details
-
createElement
-
createUncacheableElement
- Returns:
- a
CacheElement
that is marked to be uncacheable
-
put
-
get
- Parameters:
key
-- Returns:
- the
CacheElement
forkey
andnull
otherwise
-
get
Returns cached object associated with thekey
in the cache, obtaining that value from thevalueLoader
if necessary. It provides a simple substitute for the conventional "if cached, return; otherwise create, cache and return" pattern. The entire method invocation is performed atomically and the function is called at most once per key. Concurrent requests with the same key are blocked until the value is obtained from the function.- 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
-
remove
-
clear
void clear() -
getTimeToIdleSeconds
int getTimeToIdleSeconds() -
getTimeToLiveSeconds
int getTimeToLiveSeconds() -
getSize
int getSize() -
getMaxSize
int getMaxSize()
-