Package org.craftercms.core.service
Interface CacheService
-
- All Known Implementing Classes:
CacheServiceImpl
public interface CacheService- Author:
- Sumer Jabri, Alfonso Vásquez
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddScope(Context context)Adds 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.Objectget(Context context, Object key)Retrieves an item's value from the scope of the given context, or null if not found.CacheItemgetItem(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.intgetSize(Context context)Returns the quantity of items present in scope of the given context.CacheStatisticsgetStatistics(Context context)Returns the statistics for the scope of the given context.booleanhasKey(Context context, Object key)Returns true if there's and item with the specified key in the scope of the given context.booleanhasScope(Context context)Returns true if the scope of the given context exists.voidput(Context context, Object key, Object value)Puts 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.booleanremove(Context context, Object key)Removes an item from the scope of the given context.voidremoveScope(Context context)Removes the scope associated to the given context
-
-
-
Method Detail
-
getScopes
Collection<String> getScopes() throws InternalCacheEngineException
Returns the list of scopes this cache manages.- Throws:
InternalCacheEngineException
-
clearAll
void clearAll() throws InternalCacheEngineExceptionClears the contents of the entire cache.- Throws:
InternalCacheEngineException
-
addScope
void addScope(Context context) throws InternalCacheEngineException
Adds a new scope to the cache for the given context.- Throws:
InternalCacheEngineException
-
removeScope
void removeScope(Context context) throws InvalidContextException, InternalCacheEngineException
Removes the scope associated to the given context
-
hasScope
boolean hasScope(Context context) throws InvalidContextException, InternalCacheEngineException
Returns true if the scope of the given context exists.
-
getSize
int getSize(Context context) throws InvalidContextException, InternalCacheEngineException
Returns the quantity of items present in scope of the given context.
-
getKeys
Collection<?> getKeys(Context context) throws InvalidContextException, InternalCacheEngineException
Returns a list of the keys of the items present in the scope of the given context.
-
hasKey
boolean hasKey(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
Returns true if there's and item with the specified key in the scope of the given context.
-
getItem
CacheItem getItem(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
Retrieves an item from the scope of the given context, or null if not found.
-
get
Object get(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
Retrieves an item's value from the scope of the given context, or null if not found.
-
put
void put(Context context, Object key, Object value) throws InvalidContextException, InternalCacheEngineException
Puts an item in the scope of the given context.
-
put
void put(Context context, Object key, Object value, CachingOptions cachingOptions, CacheLoader loader, Object... loaderParams) throws InvalidContextException, InternalCacheEngineException
Puts and item in the scope of the given context.
-
remove
boolean remove(Context context, Object key) throws InvalidContextException, InternalCacheEngineException
Removes an item from the scope of the given context.
-
clearScope
void clearScope(Context context) throws InvalidContextException, InternalCacheEngineException
Clears the contents of the scope of the given context.
-
getStatistics
CacheStatistics getStatistics(Context context)
Returns the statistics for the scope of the given context.
-
-