public class CacheWrapper extends Object implements CacheManagement
Modifier and Type | Field and Description |
---|---|
CacheManagement |
cache |
Modifier | Constructor and Description |
---|---|
protected |
CacheWrapper(CacheManagement cache) |
Modifier and Type | Method and Description |
---|---|
Serializable |
get(String key)
Get method to retrieve value from cache Must not raise exception if the key is null, but return null
|
String |
getName()
Get cache name as specified in the descriptor
|
long |
getSize()
Returns this cache size (approximate number of entries), or
-1 if the number of entries is unknown or too
expensive to compute. |
boolean |
hasEntry(String key)
Check if a given key is present inside the cache.
|
void |
invalidate(String key)
Invalidate the given key
|
void |
invalidateAll()
Invalidate all key-value stored in the cache
|
void |
invalidateLocal(String key)
Invalidates the given key locally.
|
void |
invalidateLocalAll()
Invalidates all keys locally.
|
Set<String> |
keySet()
Returns the set of all keys stored in the cache.
|
void |
put(String key,
Serializable value)
Put method to store a
Serializable value |
void |
putLocal(String key,
Serializable value)
Stores a
Serializable value into the cache locally. |
void |
start()
Starts this cache.
|
void |
stop()
Stops this cache and releases related resources.
|
String |
toString() |
public final CacheManagement cache
protected CacheWrapper(CacheManagement cache)
public String getName()
Cache
public Serializable get(String key)
Cache
get
in interface Cache
key
- the string keySerializable
value, return null if the key does not exist or if the key is nullpublic Set<String> keySet()
Cache
public void invalidateLocal(String key)
CacheManagement
invalidateLocal
in interface CacheManagement
key
- the key to remove from the cachepublic void invalidate(String key)
Cache
invalidate
in interface Cache
public void invalidateLocalAll()
CacheManagement
invalidateLocalAll
in interface CacheManagement
public void invalidateAll()
Cache
invalidateAll
in interface Cache
public void putLocal(String key, Serializable value)
CacheManagement
Serializable
value into the cache locally. Does not propagate invalidations.putLocal
in interface CacheManagement
key
- the keyvalue
- the valuepublic void put(String key, Serializable value)
Cache
Serializable
valuepublic boolean hasEntry(String key)
Cache
public void start()
CacheManagement
start
in interface CacheManagement
public void stop()
CacheManagement
stop
in interface CacheManagement
public long getSize()
CacheManagement
-1
if the number of entries is unknown or too
expensive to compute.getSize
in interface CacheManagement
-1
Copyright © 2018 Nuxeo. All rights reserved.