public class NoopCacheStoreAdapter extends Object implements CacheStoreAdapter
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.| Constructor and Description |
|---|
NoopCacheStoreAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addScope(String scope,
int maxItemsInMemory)
Adds a new scope to the underlying store.
|
void |
clearAll()
Clears the contents of the entire store.
|
void |
clearScope(String scope)
Clears the contents of the specified scope in the underlying store.
|
CacheItem |
get(String scope,
Object key)
Retrieves an item from a scope.
|
Collection<Object> |
getKeys(String scope)
Returns a list of the keys of the items present in the specified scope.
|
Collection<String> |
getScopes()
Returns the scopes managed by the underlying store.
|
int |
getSize(String scope)
Returns the quantity of items present in the specified scope.
|
CacheStatistics |
getStatistics(String scope)
Returns the statistics of the specified scope from the underlying store.
|
boolean |
hasKey(String scope,
Object key)
Returns true if there's and item with the specified key in the specified scope.
|
boolean |
hasScope(String scope)
Returns true if the specified scope exists in the cache.
|
void |
put(CacheItem item)
Puts an item in a scope.
|
boolean |
remove(String scope,
Object key)
Removes an item from a scope.
|
void |
removeScope(String scope)
Removes an existing scope and all the items that are in it.
|
public boolean hasScope(String scope) throws Exception
CacheStoreAdapterhasScope in interface CacheStoreAdapterExceptionpublic Collection<String> getScopes()
CacheStoreAdaptergetScopes in interface CacheStoreAdapterpublic void addScope(String scope, int maxItemsInMemory)
CacheStoreAdapteraddScope in interface CacheStoreAdapterscope - the name of the scopemaxItemsInMemory - the maximum number of items in memory, before they are evictedpublic void removeScope(String scope)
CacheStoreAdapterremoveScope in interface CacheStoreAdapterscope - scope to removepublic int getSize(String scope)
CacheStoreAdaptergetSize in interface CacheStoreAdapterpublic Collection<Object> getKeys(String scope)
CacheStoreAdaptergetKeys in interface CacheStoreAdapterpublic boolean hasKey(String scope, Object key)
CacheStoreAdapterhasKey in interface CacheStoreAdapterpublic CacheItem get(String scope, Object key)
CacheStoreAdapterget in interface CacheStoreAdapterscope - scope to get the item fromkey - unique key for the item within this scopepublic void put(CacheItem item)
CacheStoreAdapterCacheItem.getScope().put in interface CacheStoreAdapteritem - the item to putpublic boolean remove(String scope, Object key)
CacheStoreAdapterremove in interface CacheStoreAdapterscope - scope to remove the item fromkey - unique key for the item within this scopepublic void clearAll()
CacheStoreAdapterclearAll in interface CacheStoreAdapterpublic void clearScope(String scope)
CacheStoreAdapterclearScope in interface CacheStoreAdapterscope - scope to clearpublic CacheStatistics getStatistics(String scope)
CacheStoreAdaptergetStatistics in interface CacheStoreAdapterscope - scope to inspectCopyright © 2018 CrafterCMS. All rights reserved.