public class CacheServiceImpl extends Object implements CacheService
CacheService. Adapts a Cache.| Constructor and Description |
|---|
CacheServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addScope(Context context)
Adds a new scope to the cache for the given context.
|
void |
clearAll()
Clears the contents of the entire cache.
|
void |
clearScope(Context context)
Clears the contents of the scope of the given context.
|
Object |
get(Context context,
Object key)
Retrieves an item's value from the scope of the given context, or null if not found.
|
CacheItem |
getItem(Context context,
Object key)
Retrieves an item from the scope of the given context, or null if not found.
|
Collection<?> |
getKeys(Context context)
Returns a list of the keys of the items present in the scope of the given context.
|
Collection<String> |
getScopes()
Returns the list of scopes this cache manages.
|
int |
getSize(Context context)
Returns the quantity of items present in scope of the given context.
|
CacheStatistics |
getStatistics(Context context)
Returns the statistics for the scope of the given context.
|
boolean |
hasKey(Context context,
Object key)
Returns true if there's and item with the specified key in the scope of the given context.
|
boolean |
hasScope(Context context)
Returns true if the scope of the given context exists.
|
void |
put(Context context,
Object key,
Object value)
Puts an item in the scope of the given context.
|
void |
put(Context context,
Object key,
Object value,
CachingOptions cachingOptions,
CacheLoader loader,
Object... loaderParams)
Puts and item in the scope of the given context.
|
boolean |
remove(Context context,
Object key)
Removes an item from the scope of the given context.
|
void |
removeScope(Context context)
Removes the scope associated to the given context
|
void |
setCache(Cache cache)
Sets the cache engine.
|
protected Cache cache
public void setCache(Cache cache)
cache - public Collection<String> getScopes() throws InternalCacheEngineException
CacheServicegetScopes in interface CacheServiceInternalCacheEngineExceptionpublic void clearAll()
throws InternalCacheEngineException
CacheServiceclearAll in interface CacheServiceInternalCacheEngineExceptionpublic void addScope(Context context) throws InternalCacheEngineException
CacheServiceaddScope in interface CacheServiceInternalCacheEngineExceptionpublic void removeScope(Context context) throws InvalidContextException, InternalCacheEngineException
CacheServiceremoveScope in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic boolean hasScope(Context context) throws InvalidContextException, InternalCacheEngineException
CacheServicehasScope in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic int getSize(Context context) throws InvalidContextException, InternalCacheEngineException
CacheServicegetSize in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic Collection<?> getKeys(Context context) throws InvalidContextException, InternalCacheEngineException
CacheServicegetKeys in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic boolean hasKey(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
CacheServicehasKey in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic CacheItem getItem(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
CacheServicegetItem in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic Object get(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
CacheServiceget in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic void put(Context context, Object key, Object value) throws InvalidContextException, InternalCacheEngineException
CacheServiceput in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic void put(Context context, Object key, Object value, CachingOptions cachingOptions, CacheLoader loader, Object... loaderParams) throws InvalidContextException, InternalCacheEngineException
CacheServiceput in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic boolean remove(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
CacheServiceremove in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic void clearScope(Context context) throws InvalidContextException, InternalCacheEngineException
CacheServiceclearScope in interface CacheServiceInvalidContextExceptionInternalCacheEngineExceptionpublic CacheStatistics getStatistics(Context context)
CacheServicegetStatistics in interface CacheServiceCopyright © 2018 CrafterCMS. All rights reserved.