|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A cache implementation with a fixed maximum size which removes the least recently used entry if an entry is added when full.
Method Summary | |
void |
clear()
Clears the cache. |
Object |
get(Object key)
Gets the value mapped to the key specified. |
int |
getGroupCount()
Returns the current number of groups in the cache. |
String[] |
getGroupNames()
Returns the names of the groups currently in cache. |
int |
getMaxSize()
Gets the maximum size of the cache (the bound). |
int |
getSize()
Returns the size of the cache. |
boolean |
isEmpty()
Checks whether the cache is empty or not. |
boolean |
isFull()
Returns true if the cache is full and no new mappings can be
added. |
boolean |
isScanUntilRemovable()
Whether the cache will scan until a removable entry is found when the map is full. |
void |
put(Object key,
Object value,
String group)
Adds a new entry to the cache. |
void |
put(Object key,
Object value,
String group,
int refreshPeriod)
Adds a new entry to the cache. |
void |
remove(Object key)
Removes an entry from the cache. |
void |
removeGroup(String group)
Removes all the entries that belong to the specified group. |
Method Detail |
public void clear()
public Object get(Object key)
Gets the value mapped to the key specified.
This operation changes the position of the key in the map to the most recently used position (first).
key
- the key of the mapping.
null
if no match.public int getGroupCount()
public String[] getGroupNames()
public int getMaxSize()
public int getSize()
public boolean isEmpty()
public boolean isFull()
true
if the cache is full and no new mappings can be
added.
true
if the cache is full.public boolean isScanUntilRemovable()
true
if the cache scans.public void put(Object key, Object value, String group)
key
- the key used to map the entry.value
- the object to cache.group
- the group the entry will belong to.public void put(Object key, Object value, String group, int refreshPeriod)
key
- the key used to map the entry.value
- the object to cache.group
- the group the entry will belong to.refreshPeriod
- how long the entry should stay in the cache (in seconds).public void remove(Object key)
key
- the key that identifies the entry to remove.public void removeGroup(String group)
group
- the name of the group to remove.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |