Package org.craftercms.core.service.impl
Class CacheServiceImpl
java.lang.Object
org.craftercms.core.service.impl.CacheServiceImpl
- All Implemented Interfaces:
CacheService
Default implementation of
CacheService. Adapts a Cache.- Author:
- Sumer Jabri, Alfonso Vásquez
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new scope to the cache for the given context.voidclearAll()Clears the contents of the entire cache.voidclearScope(Context context) Clears the contents of the scope of the given context.Retrieves an item's value from the scope of the given context, or null if not found.Retrieves an item from the scope of the given context, or null if not found.Collection<?> Returns a list of the keys of the items present in the scope of the given context.Returns the list of scopes this cache manages.intReturns the quantity of items present in scope of the given context.getStatistics(Context context) Returns the statistics for the scope of the given context.booleanReturns true if there's and item with the specified key in the scope of the given context.booleanReturns true if the scope of the given context exists.voidPuts an item in the scope of the given context.voidput(Context context, Object key, Object value, CachingOptions cachingOptions, CacheLoader loader, Object... loaderParams) Puts and item in the scope of the given context.booleanRemoves an item from the scope of the given context.voidremoveScope(Context context) Removes the scope associated to the given context
-
Field Details
-
cache
-
-
Constructor Details
-
CacheServiceImpl
-
-
Method Details
-
getScopes
Description copied from interface:CacheServiceReturns the list of scopes this cache manages.- Specified by:
getScopesin interfaceCacheService- Throws:
InternalCacheEngineException
-
clearAll
Description copied from interface:CacheServiceClears the contents of the entire cache.- Specified by:
clearAllin interfaceCacheService- Throws:
InternalCacheEngineException
-
addScope
Description copied from interface:CacheServiceAdds a new scope to the cache for the given context.- Specified by:
addScopein interfaceCacheService- Throws:
InternalCacheEngineException
-
removeScope
public void removeScope(Context context) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceRemoves the scope associated to the given context- Specified by:
removeScopein interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
hasScope
public boolean hasScope(Context context) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceReturns true if the scope of the given context exists.- Specified by:
hasScopein interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
getSize
Description copied from interface:CacheServiceReturns the quantity of items present in scope of the given context.- Specified by:
getSizein interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
getKeys
public Collection<?> getKeys(Context context) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceReturns a list of the keys of the items present in the scope of the given context.- Specified by:
getKeysin interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
hasKey
public boolean hasKey(Context context, Object key) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceReturns true if there's and item with the specified key in the scope of the given context.- Specified by:
hasKeyin interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
getItem
public CacheItem getItem(Context context, Object key) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceRetrieves an item from the scope of the given context, or null if not found.- Specified by:
getItemin interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
get
public Object get(Context context, Object key) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceRetrieves an item's value from the scope of the given context, or null if not found.- Specified by:
getin interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
put
public void put(Context context, Object key, Object value) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServicePuts an item in the scope of the given context.- Specified by:
putin interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
put
public void put(Context context, Object key, Object value, CachingOptions cachingOptions, CacheLoader loader, Object... loaderParams) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServicePuts and item in the scope of the given context.- Specified by:
putin interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
remove
public boolean remove(Context context, Object key) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceRemoves an item from the scope of the given context.- Specified by:
removein interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
clearScope
public void clearScope(Context context) throws InvalidContextException, InternalCacheEngineException Description copied from interface:CacheServiceClears the contents of the scope of the given context.- Specified by:
clearScopein interfaceCacheService- Throws:
InvalidContextExceptionInternalCacheEngineException
-
getStatistics
Description copied from interface:CacheServiceReturns the statistics for the scope of the given context.- Specified by:
getStatisticsin interfaceCacheService
-