public class InMemoryCacheImpl extends AbstractCache
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.cache.Cache<String,Serializable> |
cache |
name, ttl| Constructor and Description |
|---|
InMemoryCacheImpl(CacheDescriptor desc) |
| 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
|
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. |
getName, start, stop, toStringprotected final com.google.common.cache.Cache<String,Serializable> cache
public InMemoryCacheImpl(CacheDescriptor desc)
public Serializable get(String key)
Cachekey - the string keySerializable value, return null if the key does not exist or if the key is nullpublic Set<String> keySet()
CacheSet of all keyspublic void invalidate(String key)
Cachepublic void invalidateLocal(String key)
CacheManagementkey - the key to remove from the cachepublic void invalidateAll()
Cachepublic void invalidateLocalAll()
CacheManagementpublic void put(String key, Serializable value)
CacheSerializable valuekey - the string key, if null, the value will not be storedvalue - the value to store, if null, the value will not be storedpublic void putLocal(String key, Serializable value)
CacheManagementSerializable value into the cache locally. Does not propagate invalidations.key - the keyvalue - the valuepublic boolean hasEntry(String key)
Cachekey - the string keypublic long getSize()
CacheManagement-1 if the number of entries is unknown or too
expensive to compute.-1Copyright © 2019 Nuxeo. All rights reserved.