Constructor and Description |
---|
MapCache(String name,
Map<K,V> backingMap) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all entries from the cache.
|
V |
get(K key)
Returns the Cached value stored under the specified
key or
null if there is no Cache entry for that key . |
Set<K> |
keys()
Returns a view of all the keys for entries contained in this cache.
|
V |
put(K key,
V value)
Adds a Cache entry.
|
V |
remove(K key)
Remove the cache entry corresponding to the specified key.
|
int |
size()
Returns the number of entries in the cache.
|
String |
toString() |
Collection<V> |
values()
Returns a view of all of the values contained in this cache.
|
public V get(K key) throws CacheException
Cache
key
or
null
if there is no Cache entry for that key
.get
in interface Cache<K,V>
key
- the key that the value was previous added withnull
if there is no entry for the specified key
CacheException
- if there is a problem accessing the underlying cache systempublic V put(K key, V value) throws CacheException
Cache
put
in interface Cache<K,V>
key
- the key used to identify the object being stored.value
- the value to be stored in the cache.key
or null
if there was previous valueCacheException
- if there is a problem accessing the underlying cache systempublic V remove(K key) throws CacheException
Cache
remove
in interface Cache<K,V>
key
- the key of the entry to be removed.key
or null
if there was previous valueCacheException
- if there is a problem accessing the underlying cache systempublic void clear() throws CacheException
Cache
clear
in interface Cache<K,V>
CacheException
- if there is a problem accessing the underlying cache systempublic int size()
Cache
public Set<K> keys()
Cache
public Collection<V> values()
Cache
Copyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.