public class MemoryCache<K extends Serializable,V> extends Object implements SimpleCache<K,V>
ConcurrentHashMap.
Note: This cache is not transaction-safe. Use it for tests or wrap it appropriately.
| Constructor and Description |
|---|
MemoryCache() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
contains(K key) |
V |
get(K key) |
Collection<K> |
getKeys() |
void |
put(K key,
V value)
Set the value to store for a given key.
|
void |
remove(K key)
Removes the cache entry whether or not the value stored against it is null.
|
public boolean contains(K key)
contains in interface SimpleCache<K extends Serializable,V>key - the cache key to check up onpublic Collection<K> getKeys()
getKeys in interface SimpleCache<K extends Serializable,V>public V get(K key)
get in interface SimpleCache<K extends Serializable,V>key - Kpublic void put(K key, V value)
SimpleCacheremove if cache entries need to be removed
as the cache implementations must treat a null value as a first class object
in exactly the same way as a Map will allow storage and retrieval of null values.put in interface SimpleCache<K extends Serializable,V>key - the key against which to store the valuevalue - the value to store. null is allowed.public void remove(K key)
SimpleCacheremove in interface SimpleCache<K extends Serializable,V>key - the key value to removepublic void clear()
clear in interface SimpleCache<K extends Serializable,V>Copyright © 2005–2019 Alfresco Software. All rights reserved.