|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides interface for a cache.
This class provides interface for a generic cache. The cached objects may
optionally implement the Cacheable
interface, which provides a basic event
handler, informing the objects about their state related to the caching process.
Method Summary | |
void |
clear()
Removes all objects from the cache. |
java.lang.Object |
get(java.lang.Object key)
Returns an object from the cache. |
void |
put(java.lang.Object key,
java.lang.Object obj)
Puts the object to the cache. |
java.lang.Object |
remove(java.lang.Object key)
Removes an object from the cache. |
Method Detail |
public void put(java.lang.Object key, java.lang.Object obj)
If an object implementing the Cacheable
interface is being added to the
cache, the Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must
be invoked on it with the Cacheable.CacheEvent.ADDED
value.
If an object implementing the Cacheable
interface must be removed from the
cache prior to inserting the new one, the
Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must be invoked on it
with the Cacheable.CacheEvent.INVALIDATED
value.
key
- the keyobj
- the cached objectpublic java.lang.Object get(java.lang.Object key)
The object still remains in the cache.
key
- the key
public java.lang.Object remove(java.lang.Object key)
If an object implementing the Cacheable
interface is being removed from the
cache, the Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must be
invoked on it with the Cacheable.CacheEvent.REMOVED
value.
key
- the key
public void clear()
If an object implementing the Cacheable
interface is being removed from the
cache, the Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must be invoked
on it with the Cacheable.CacheEvent.INVALIDATED
value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |