|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shiro.cache.MapCache<K,V>
public class MapCache<K,V>
A MapCache
is a Cache
implementation that uses a backing Map
instance to store
and retrieve cached data.
Constructor Summary | |
---|---|
MapCache(String name,
Map<K,V> backingMap)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MapCache(String name, Map<K,V> backingMap)
Method Detail |
---|
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 with
null
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 value
CacheException
- 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 value
CacheException
- 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
size
in interface Cache<K,V>
public Set<K> keys()
Cache
keys
in interface Cache<K,V>
public Collection<V> values()
Cache
values
in interface Cache<K,V>
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |