Package org.nuxeo.ecm.core.cache
Class CacheWrapper
- java.lang.Object
-
- org.nuxeo.ecm.core.cache.CacheWrapper
-
- All Implemented Interfaces:
Cache,CacheManagement
- Direct Known Subclasses:
CacheAttributesChecker,CacheInvalidator,CacheMetrics
public class CacheWrapper extends Object implements CacheManagement
- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description CacheManagementcache
-
Constructor Summary
Constructors Modifier Constructor Description protectedCacheWrapper(CacheManagement cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Serializableget(String key)Get method to retrieve value from cache Must not raise exception if the key is null, but return nullStringgetName()Get cache name as specified in the descriptorlonggetSize()Returns this cache size (approximate number of entries), or-1if the number of entries is unknown or too expensive to compute.booleanhasEntry(String key)Check if a given key is present inside the cache.voidinvalidate(String key)Invalidate the given keyvoidinvalidateAll()Invalidate all key-value stored in the cachevoidinvalidateLocal(String key)Invalidates the given key locally.voidinvalidateLocalAll()Invalidates all keys locally.Set<String>keySet()Returns the set of all keys stored in the cache.voidput(String key, Serializable value)Put method to store aSerializablevaluevoidputLocal(String key, Serializable value)Stores aSerializablevalue into the cache locally.voidstart()Starts this cache.voidstop()Stops this cache and releases related resources.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.cache.Cache
computeIfAbsent
-
-
-
-
Field Detail
-
cache
public final CacheManagement cache
-
-
Constructor Detail
-
CacheWrapper
protected CacheWrapper(CacheManagement cache)
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:CacheGet cache name as specified in the descriptor
-
get
public Serializable get(String key)
Description copied from interface:CacheGet method to retrieve value from cache Must not raise exception if the key is null, but return null- Specified by:
getin interfaceCache- Parameters:
key- the string key- Returns:
- the
Serializablevalue, return null if the key does not exist or if the key is null
-
keySet
public Set<String> keySet()
Description copied from interface:CacheReturns the set of all keys stored in the cache.
-
invalidateLocal
public void invalidateLocal(String key)
Description copied from interface:CacheManagementInvalidates the given key locally. Does not propagate invalidations.- Specified by:
invalidateLocalin interfaceCacheManagement- Parameters:
key- the key to remove from the cache
-
invalidate
public void invalidate(String key)
Description copied from interface:CacheInvalidate the given key- Specified by:
invalidatein interfaceCache- Parameters:
key- , the key to remove from the cache, if null will do nothing
-
invalidateLocalAll
public void invalidateLocalAll()
Description copied from interface:CacheManagementInvalidates all keys locally. Does not propagate invalidations.- Specified by:
invalidateLocalAllin interfaceCacheManagement
-
invalidateAll
public void invalidateAll()
Description copied from interface:CacheInvalidate all key-value stored in the cache- Specified by:
invalidateAllin interfaceCache
-
putLocal
public void putLocal(String key, Serializable value)
Description copied from interface:CacheManagementStores aSerializablevalue into the cache locally. Does not propagate invalidations.- Specified by:
putLocalin interfaceCacheManagement- Parameters:
key- the keyvalue- the value
-
put
public void put(String key, Serializable value)
Description copied from interface:CachePut method to store aSerializablevalue
-
hasEntry
public boolean hasEntry(String key)
Description copied from interface:CacheCheck if a given key is present inside the cache. Compared to the get() method, this method must not update internal cache state and change TTL
-
start
public void start()
Description copied from interface:CacheManagementStarts this cache.- Specified by:
startin interfaceCacheManagement
-
stop
public void stop()
Description copied from interface:CacheManagementStops this cache and releases related resources.- Specified by:
stopin interfaceCacheManagement
-
getSize
public long getSize()
Description copied from interface:CacheManagementReturns this cache size (approximate number of entries), or-1if the number of entries is unknown or too expensive to compute.- Specified by:
getSizein interfaceCacheManagement- Returns:
- the approximate number of entries, or
-1
-
-