@AlfrescoPublicApi
public interface SimpleCache<K extends Serializable,V>
All implementations must be thread-safe. Additionally, the use of the Serializable for both keys and values ensures that the underlying cache implementations can support both clustered caches as well as persistent caches.
All implementations must support null values. It therefore follows that
(simpleCache.contains(key) == true) does not imply (simpleCache.get(key) != null)but
(simpleCache.contains(key) == false) implies (simpleCache.get(key) == null)
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.
|
boolean contains(K key)
key
- the cache key to check up onCollection<K> getKeys()
V get(K key)
key
- Kvoid put(K key, V value)
remove
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.key
- the key against which to store the valuevalue
- the value to store. null is allowed.void remove(K key)
key
- the key value to removevoid clear()
Copyright © 2005–2016 Alfresco Software. All rights reserved.