Package org.apache.shiro.cache
Class MapCache<K,V>
- java.lang.Object
-
- org.apache.shiro.cache.MapCache<K,V>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries from the cache.Vget(K key)Returns the Cached value stored under the specifiedkeyornullif there is no Cache entry for thatkey.Set<K>keys()Returns a view of all the keys for entries contained in this cache.Vput(K key, V value)Adds a Cache entry.Vremove(K key)Remove the cache entry corresponding to the specified key.intsize()Returns the number of entries in the cache.StringtoString()Collection<V>values()Returns a view of all of the values contained in this cache.
-
-
-
Method Detail
-
get
public V get(K key) throws CacheException
Description copied from interface:CacheReturns the Cached value stored under the specifiedkeyornullif there is no Cache entry for thatkey.- Specified by:
getin interfaceCache<K,V>- Parameters:
key- the key that the value was previous added with- Returns:
- the cached object or
nullif there is no entry for the specifiedkey - Throws:
CacheException- if there is a problem accessing the underlying cache system
-
put
public V put(K key, V value) throws CacheException
Description copied from interface:CacheAdds a Cache entry.- Specified by:
putin interfaceCache<K,V>- Parameters:
key- the key used to identify the object being stored.value- the value to be stored in the cache.- Returns:
- the previous value associated with the given
keyornullif there was previous value - Throws:
CacheException- if there is a problem accessing the underlying cache system
-
remove
public V remove(K key) throws CacheException
Description copied from interface:CacheRemove the cache entry corresponding to the specified key.- Specified by:
removein interfaceCache<K,V>- Parameters:
key- the key of the entry to be removed.- Returns:
- the previous value associated with the given
keyornullif there was previous value - Throws:
CacheException- if there is a problem accessing the underlying cache system
-
clear
public void clear() throws CacheExceptionDescription copied from interface:CacheClear all entries from the cache.- Specified by:
clearin interfaceCache<K,V>- Throws:
CacheException- if there is a problem accessing the underlying cache system
-
size
public int size()
Description copied from interface:CacheReturns the number of entries in the cache.
-
keys
public Set<K> keys()
Description copied from interface:CacheReturns a view of all the keys for entries contained in this cache.
-
values
public Collection<V> values()
Description copied from interface:CacheReturns a view of all of the values contained in this cache.
-
-