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
- Since:
- 9.1
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet method to retrieve value from cache Must not raise exception if the key is null, but return nullgetName()
Get cache name as specified in the descriptorlong
getSize()
Returns this cache size (approximate number of entries), or-1
if the number of entries is unknown or too expensive to compute.boolean
Check if a given key is present inside the cache.void
invalidate
(String key) Invalidate the given keyvoid
Invalidate all key-value stored in the cachevoid
invalidateLocal
(String key) Invalidates the given key locally.void
Invalidates all keys locally.keySet()
Returns the set of all keys stored in the cache.void
put
(String key, Serializable value) Put method to store aSerializable
valuevoid
putLocal
(String key, Serializable value) Stores aSerializable
value into the cache locally.void
start()
Starts this cache.void
stop()
Stops this cache and releases related resources.toString()
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 Details
-
cache
-
-
Constructor Details
-
CacheWrapper
-
-
Method Details
-
getName
Description copied from interface:Cache
Get cache name as specified in the descriptor -
get
Description copied from interface:Cache
Get method to retrieve value from cache Must not raise exception if the key is null, but return null- Specified by:
get
in interfaceCache
- Parameters:
key
- the string key- Returns:
- the
Serializable
value, return null if the key does not exist or if the key is null
-
keySet
Description copied from interface:Cache
Returns the set of all keys stored in the cache. -
invalidateLocal
Description copied from interface:CacheManagement
Invalidates the given key locally. Does not propagate invalidations.- Specified by:
invalidateLocal
in interfaceCacheManagement
- Parameters:
key
- the key to remove from the cache
-
invalidate
Description copied from interface:Cache
Invalidate the given key- Specified by:
invalidate
in interfaceCache
- Parameters:
key
- , the key to remove from the cache, if null will do nothing
-
invalidateLocalAll
public void invalidateLocalAll()Description copied from interface:CacheManagement
Invalidates all keys locally. Does not propagate invalidations.- Specified by:
invalidateLocalAll
in interfaceCacheManagement
-
invalidateAll
public void invalidateAll()Description copied from interface:Cache
Invalidate all key-value stored in the cache- Specified by:
invalidateAll
in interfaceCache
-
putLocal
Description copied from interface:CacheManagement
Stores aSerializable
value into the cache locally. Does not propagate invalidations.- Specified by:
putLocal
in interfaceCacheManagement
- Parameters:
key
- the keyvalue
- the value
-
put
Description copied from interface:Cache
Put method to store aSerializable
value -
hasEntry
Description copied from interface:Cache
Check 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:CacheManagement
Starts this cache.- Specified by:
start
in interfaceCacheManagement
-
stop
public void stop()Description copied from interface:CacheManagement
Stops this cache and releases related resources.- Specified by:
stop
in interfaceCacheManagement
-
getSize
public long getSize()Description copied from interface:CacheManagement
Returns this cache size (approximate number of entries), or-1
if the number of entries is unknown or too expensive to compute.- Specified by:
getSize
in interfaceCacheManagement
- Returns:
- the approximate number of entries, or
-1
-
toString
-