Class NoopCacheStoreAdapter
java.lang.Object
org.craftercms.core.cache.impl.store.NoopCacheStoreAdapter
- All Implemented Interfaces:
CacheStoreAdapter
Implementation of a
CacheStoreAdapter that uses no data structure and whose
operations do nothing. Useful
in scenarios where you need a cache reference but don't need to cache anything or it's not appropriate, and when
testing or troubleshooting.- Author:
- Sumer Jabri, Alfonso Vásquez
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new scope to the underlying store.voidclearAll()Clears the contents of the entire store.voidclearScope(String scope) Clears the contents of the specified scope in the underlying store.Retrieves an item from a scope.Returns a list of the keys of the items present in the specified scope.Returns the scopes managed by the underlying store.intReturns the quantity of items present in the specified scope.getStatistics(String scope) Returns the statistics of the specified scope from the underlying store.booleanReturns true if there's and item with the specified key in the specified scope.booleanReturns true if the specified scope exists in the cache.voidPuts an item in a scope.booleanRemoves an item from a scope.voidremoveScope(String scope) Removes an existing scope and all the items that are in it.
-
Constructor Details
-
NoopCacheStoreAdapter
public NoopCacheStoreAdapter()
-
-
Method Details
-
hasScope
Description copied from interface:CacheStoreAdapterReturns true if the specified scope exists in the cache.- Specified by:
hasScopein interfaceCacheStoreAdapter- Throws:
Exception
-
getScopes
Description copied from interface:CacheStoreAdapterReturns the scopes managed by the underlying store.- Specified by:
getScopesin interfaceCacheStoreAdapter
-
addScope
Description copied from interface:CacheStoreAdapterAdds a new scope to the underlying store.- Specified by:
addScopein interfaceCacheStoreAdapter- Parameters:
scope- the name of the scopemaxItemsInMemory- the maximum number of items in memory, before they are evicted
-
removeScope
Description copied from interface:CacheStoreAdapterRemoves an existing scope and all the items that are in it.- Specified by:
removeScopein interfaceCacheStoreAdapter- Parameters:
scope- scope to remove
-
getSize
Description copied from interface:CacheStoreAdapterReturns the quantity of items present in the specified scope.- Specified by:
getSizein interfaceCacheStoreAdapter- Returns:
- the size of the scope (quantity of items)
-
getKeys
Description copied from interface:CacheStoreAdapterReturns a list of the keys of the items present in the specified scope.- Specified by:
getKeysin interfaceCacheStoreAdapter- Returns:
- a list of the keys of the available items in the scope
-
hasKey
Description copied from interface:CacheStoreAdapterReturns true if there's and item with the specified key in the specified scope.- Specified by:
hasKeyin interfaceCacheStoreAdapter- Returns:
- true if the key exists in the scope, false otherwise
-
get
Description copied from interface:CacheStoreAdapterRetrieves an item from a scope.- Specified by:
getin interfaceCacheStoreAdapter- Parameters:
scope- scope to get the item fromkey- unique key for the item within this scope- Returns:
- the requested item if found, null otherwise
-
put
Description copied from interface:CacheStoreAdapterPuts an item in a scope. The scope is obtained throughCacheItem.getScope().- Specified by:
putin interfaceCacheStoreAdapter- Parameters:
item- the item to put
-
remove
Description copied from interface:CacheStoreAdapterRemoves an item from a scope.- Specified by:
removein interfaceCacheStoreAdapter- Parameters:
scope- scope to remove the item fromkey- unique key for the item within this scope- Returns:
- true if the removal was successful, false otherwise
-
clearAll
public void clearAll()Description copied from interface:CacheStoreAdapterClears the contents of the entire store.- Specified by:
clearAllin interfaceCacheStoreAdapter
-
clearScope
Description copied from interface:CacheStoreAdapterClears the contents of the specified scope in the underlying store.- Specified by:
clearScopein interfaceCacheStoreAdapter- Parameters:
scope- scope to clear
-
getStatistics
Description copied from interface:CacheStoreAdapterReturns the statistics of the specified scope from the underlying store.- Specified by:
getStatisticsin interfaceCacheStoreAdapter- Parameters:
scope- scope to inspect- Returns:
- the statistics
-