Package org.nuxeo.ecm.core.cache
Class CacheAttributesChecker
java.lang.Object
org.nuxeo.ecm.core.cache.CacheWrapper
org.nuxeo.ecm.core.cache.CacheAttributesChecker
- All Implemented Interfaces:
Cache
,CacheManagement
Class to implement mandatory check attributes before calling implementation of cache This enable to have the same
behavior for any use of cache for all implementation of cache
- Since:
- 6.0
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.cache.CacheWrapper
cache
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet method to retrieve value from cache Must not raise exception if the key is null, but return nulllong
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 cachekeySet()
Returns the set of all keys stored in the cache.void
put
(String key, Serializable value) Put method to store aSerializable
valueMethods inherited from class org.nuxeo.ecm.core.cache.CacheWrapper
getName, invalidateLocal, invalidateLocalAll, putLocal, start, stop, 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
-
Constructor Details
-
CacheAttributesChecker
-
-
Method Details
-
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
- Overrides:
get
in classCacheWrapper
- 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.- Specified by:
keySet
in interfaceCache
- Overrides:
keySet
in classCacheWrapper
- Returns:
- the
Set
of all keys
-
invalidate
Description copied from interface:Cache
Invalidate the given key- Specified by:
invalidate
in interfaceCache
- Overrides:
invalidate
in classCacheWrapper
- Parameters:
key
- , the key to remove from the cache, if null will do nothing
-
invalidateAll
public void invalidateAll()Description copied from interface:Cache
Invalidate all key-value stored in the cache- Specified by:
invalidateAll
in interfaceCache
- Overrides:
invalidateAll
in classCacheWrapper
-
put
Description copied from interface:Cache
Put method to store aSerializable
value- Specified by:
put
in interfaceCache
- Overrides:
put
in classCacheWrapper
- Parameters:
key
- the string key, if null, the value will not be storedvalue
- the value to store, if null, the value will not be stored
-
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- Specified by:
hasEntry
in interfaceCache
- Overrides:
hasEntry
in classCacheWrapper
- Parameters:
key
- the string key- Returns:
- true if a corresponding entry exists, false otherwise
-
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
- Overrides:
getSize
in classCacheWrapper
- Returns:
- the approximate number of entries, or
-1
-