|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.shiro.cache.ehcache.EhCache<K,V>
public class EhCache<K,V>
Shiro Cache
implementation that wraps an Ehcache
instance.
Constructor Summary | |
---|---|
EhCache(net.sf.ehcache.Ehcache cache)
Constructs a new EhCache instance with the given cache. |
Method Summary | |
---|---|
void |
clear()
Removes all elements in the cache, but leaves the cache in a useable state. |
V |
get(K key)
Gets a value of an element which matches the given key. |
long |
getDiskStoreSize()
Returns the size (in bytes) that this EhCache's disk store is consuming or -1 if
that number is unknown or cannot be calculated. |
long |
getMemoryStoreSize()
Returns the size (in bytes) that this EhCache's memory store is using (RAM), or -1 if
that number is unknown or cannot be calculated. |
long |
getMemoryUsage()
Returns the size (in bytes) that this EhCache is using in memory (RAM), or -1 if that
number is unknown or cannot be calculated. |
Set<K> |
keys()
Returns a view of all the keys for entries contained in this cache. |
V |
put(K key,
V value)
Puts an object into the cache. |
V |
remove(K key)
Removes the element which matches the key. |
int |
size()
Returns the number of entries in the cache. |
String |
toString()
Returns "EhCache [" + cache.getName() + "]" |
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 EhCache(net.sf.ehcache.Ehcache cache)
cache
- - delegate EhCache instance this Shiro cache instance will wrap.Method Detail |
---|
public V get(K key) throws CacheException
get
in interface Cache<K,V>
key
- the key of the element to return.
CacheException
- if there is a problem accessing the underlying cache systempublic V put(K key, V value) throws CacheException
put
in interface Cache<K,V>
key
- the key.value
- the value.
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
If no element matches, nothing is removed and no Exception is thrown.
remove
in interface Cache<K,V>
key
- the key of the element to remove
key
or null
if there was previous value
CacheException
- if there is a problem accessing the underlying cache systempublic void clear() throws CacheException
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 long getMemoryUsage()
-1
if that
number is unknown or cannot be calculated.
-1
if that
number is unknown or cannot be calculated.public long getMemoryStoreSize()
-1
if
that number is unknown or cannot be calculated.
-1
if
that number is unknown or cannot be calculated.public long getDiskStoreSize()
-1
if
that number is unknown or cannot be calculated.
-1
if
that number is unknown or cannot be calculated.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |