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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet method to retrieve value from cache Must not raise exception if the key is null, but return nulllonggetSize()Returns this cache size (approximate number of entries), or-1if the number of entries is unknown or too expensive to compute.booleanCheck if a given key is present inside the cache.voidinvalidate(String key) Invalidate the given keyvoidInvalidate all key-value stored in the cachekeySet()Returns the set of all keys stored in the cache.voidput(String key, Serializable value) Put method to store aSerializablevalueMethods inherited from class org.nuxeo.ecm.core.cache.CacheWrapper
getName, invalidateLocal, invalidateLocalAll, putLocal, start, stop, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.nuxeo.ecm.core.cache.Cache
computeIfAbsent
-
Constructor Details
-
CacheAttributesChecker
-
-
Method Details
-
get
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- Overrides:
getin classCacheWrapper- Parameters:
key- the string key- Returns:
- the
Serializablevalue, return null if the key does not exist or if the key is null
-
keySet
Description copied from interface:CacheReturns the set of all keys stored in the cache.- Specified by:
keySetin interfaceCache- Overrides:
keySetin classCacheWrapper- Returns:
- the
Setof all keys
-
invalidate
Description copied from interface:CacheInvalidate the given key- Specified by:
invalidatein interfaceCache- Overrides:
invalidatein classCacheWrapper- Parameters:
key- , the key to remove from the cache, if null will do nothing
-
invalidateAll
public void invalidateAll()Description copied from interface:CacheInvalidate all key-value stored in the cache- Specified by:
invalidateAllin interfaceCache- Overrides:
invalidateAllin classCacheWrapper
-
put
Description copied from interface:CachePut method to store aSerializablevalue- Specified by:
putin interfaceCache- Overrides:
putin 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: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- Specified by:
hasEntryin interfaceCache- Overrides:
hasEntryin classCacheWrapper- Parameters:
key- the string key- Returns:
- true if a corresponding entry exists, false otherwise
-
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- Overrides:
getSizein classCacheWrapper- Returns:
- the approximate number of entries, or
-1
-