public interface SessionCache
Eviction of SessionCache entries is accomplished by controlling the maximum number of entries in the cache. This
maximum value is set by calling setCapacity(int)
. A SessionCache may be implemented with any eviction policy
(including a policy of no eviction). Most implementations evict the eldest entry added to the cache.
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all entries from the cache.
|
boolean |
contains(java.lang.Object key)
Returns true if the cache contains a specified key, and false if it does not.
|
java.lang.Object |
get(java.lang.Object key)
Returns a reference to an entry's value in the cache corresponding to a specified key, or null if no entry with
that key exists.
|
int |
getCapacity()
Returns the maximum number of entries in the cache.
|
int |
getEntryCount()
Returns the number of entries currently in the cache.
|
java.util.Set<java.lang.Object> |
getKeySet()
Returns a
Set view of the keys contained in the cache. |
void |
put(java.lang.Object key,
java.lang.Object value)
Adds an entry in the cache with a specified key and value.
|
java.lang.Object |
remove(java.lang.Object key)
Removes the entry with the specified key from the cache, and returns that entry's value.
|
void |
setCapacity(int capacity)
Sets the maximum number of entries in the cache.
|
void clear()
boolean contains(java.lang.Object key)
key
- the entry key in question.java.lang.Object get(java.lang.Object key)
key
- the entry key to look for.int getCapacity()
int getEntryCount()
java.util.Set<java.lang.Object> getKeySet()
Set
view of the keys contained in the cache.Set
view of the keys contained in the cache.void put(java.lang.Object key, java.lang.Object value)
key
- the entry's key.value
- the entry's value.java.lang.Object remove(java.lang.Object key)
key
- the entry key to look for.void setCapacity(int capacity)
capacity
- maximum number of enties in the cache.