|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Cache
Cache Generic cache interface
| Method Summary | |
|---|---|
void |
add(java.lang.Object key,
java.lang.Object value)
add the given value to the cache at the specified key |
void |
add(java.lang.Object key,
java.lang.Object value,
int size)
add the given value with specified size to the cache at specified key |
void |
addCacheListener(CacheListener listener)
add the cache module listener |
int |
clear()
clear all the entries from the cache. |
void |
clearStats()
clear all stats |
boolean |
contains(java.lang.Object key)
check if the cache contains the item at the key |
void |
destroy()
Destroys this cache. |
java.util.Enumeration |
elements()
get an Enumeration for the keys stored in the cache |
java.lang.Object |
get(java.lang.Object key)
get the item stored at the key. |
java.util.Iterator |
getAll(java.lang.Object key)
get all the items with the given key. |
int |
getEntryCount()
get the number of entries in the cache |
int |
getIndex(java.lang.Object key)
get the index of the item given a key |
java.lang.Object |
getStatByName(java.lang.String key)
get the desired statistic counter |
java.util.Map |
getStats()
get the stats snapshot |
void |
init(int maxEntries,
float loadFactor,
java.util.Properties props)
initialize the cache |
void |
init(int maxEntries,
java.util.Properties props)
initialize the cache with the default load factor (0.75) |
boolean |
isEmpty()
is this cache empty? |
java.util.Iterator |
keys()
get an Iterator for the keys stored in the cache |
void |
notifyRefresh(int index)
notify threads waiting for a refresh on the object associated with the key |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
cache the given value at the specified key and return previous value |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value,
int size)
cache the given value at the specified key and return previous value |
java.lang.Object |
remove(java.lang.Object key)
remove the item with the given key. |
java.lang.Object |
remove(java.lang.Object key,
java.lang.Object value)
remove the given value stored at the key. |
void |
removeAll(java.lang.Object key)
remove all the item with the given key. |
void |
trimExpiredEntries(int maxCount)
trim the expired entries from the cache. |
java.util.Iterator |
values()
get an Iterator for the values stored in the cache |
boolean |
waitRefresh(int index)
wait for a refresh on the object associated with the key |
| Method Detail |
|---|
void init(int maxEntries,
float loadFactor,
java.util.Properties props)
throws java.lang.Exception
maxEntries - maximum number of entries expected in the cacheloadFactor - the load factorprops - opaque list of properties for a given cache implementation
a - generic Exception if the initialization failed
java.lang.Exception
void init(int maxEntries,
java.util.Properties props)
throws java.lang.Exception
maxEntries - maximum number of entries expected in the cacheprops - opaque list of properties for a given cache implementation
a - generic Exception if the initialization failed
java.lang.Exceptionvoid addCacheListener(CacheListener listener)
listener - CacheListener implementationint getIndex(java.lang.Object key)
key - of the entry
java.lang.Object get(java.lang.Object key)
key - lookup keyjava.util.Iterator getAll(java.lang.Object key)
key - lookup keyboolean contains(java.lang.Object key)
key - lookup keyjava.util.Iterator keys()
java.util.Enumeration elements()
java.util.Iterator values()
java.lang.Object put(java.lang.Object key,
java.lang.Object value)
key - lookup keyobject - item value to be stored
java.lang.Object put(java.lang.Object key,
java.lang.Object value,
int size)
key - lookup keyobject - item value to be storedsize - in bytes of the value being cached
void add(java.lang.Object key,
java.lang.Object value)
key - lookup keyobject - item value to be stored
This function is suitable for multi-valued keys.
void add(java.lang.Object key,
java.lang.Object value,
int size)
key - lookup keyobject - item value to be storedsize - in bytes of the value being added
This function is suitable for multi-valued keys.java.lang.Object remove(java.lang.Object key)
key - lookup key
java.lang.Object remove(java.lang.Object key,
java.lang.Object value)
key - lookup keyvalue - to match (for multi-valued keys)void removeAll(java.lang.Object key)
key - lookup keyboolean waitRefresh(int index)
index - index of the entry. The index must be obtained via
one of the getIndex() methods.void notifyRefresh(int index)
index - index of the entry. The index must be obtained via
one of the getIndex() methods.int clear()
boolean isEmpty()
int getEntryCount()
java.lang.Object getStatByName(java.lang.String key)
key - to corresponding stat
java.util.Map getStats()
void clearStats()
void trimExpiredEntries(int maxCount)
maxCount - maximum number of invalid entries to trim
specify Integer.MAX_VALUE to trim all timedout entries
This call is to be scheduled by a thread managed by the container.void destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||