public interface SessionCache
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(Object key)
Returns true if the cache contains a specified key, and false if it does not.
|
Object |
get(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.
|
Set<Object> |
getKeySet()
Returns a
Set view of the keys contained in the cache. |
void |
put(Object key,
Object value)
Adds an entry in the cache with a specified key and value.
|
Object |
remove(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(Object key)
key
- the entry key in question.Object get(Object key)
key
- the entry key to look for.int getCapacity()
int getEntryCount()
Set<Object> getKeySet()
Set
view of the keys contained in the cache.Set
view of the keys contained in the cache.void put(Object key, Object value)
key
- the entry's key.value
- the entry's value.Object remove(Object key)
key
- the entry key to look for.void setCapacity(int capacity)
capacity
- maximum number of enties in the cache.