Package org.apache.shiro.cache
Class MapCache<K,V>
java.lang.Object
org.apache.shiro.cache.MapCache<K,V>
- Type Parameters:
K- KV- V
- All Implemented Interfaces:
Cache<K,V>
A
MapCache is a Cache implementation that uses a backing Map instance to store
and retrieve cached data.- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all entries from the cache.Returns the Cached value stored under the specifiedkeyornullif there is no Cache entry for thatkey.keys()Returns a view of all the keys for entries contained in this cache.Adds a Cache entry.Remove the cache entry corresponding to the specified key.intsize()Returns the number of entries in the cache.toString()values()Returns a view of all of the values contained in this cache.
-
Constructor Details
-
MapCache
-
-
Method Details
-
get
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
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
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
Description 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
Description copied from interface:CacheReturns the number of entries in the cache. -
keys
Description copied from interface:CacheReturns a view of all the keys for entries contained in this cache. -
values
Description copied from interface:CacheReturns a view of all of the values contained in this cache. -
toString
-