|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CachePolicy
CachePolicity is an abstraction for different cache policies. (ie. MRU, time-based, soft-refs, ...)
Method Summary | |
---|---|
void |
addListener(CachePolicyListener listener)
Add a listener to this cache policy. |
java.util.Enumeration |
elements()
Enumerate through the objects currently in the cache. |
java.lang.Object |
get(java.lang.Object key)
Obtain the object stored under the key specified. |
void |
put(java.lang.Object key,
java.lang.Object value)
Place an object in the cache. |
void |
remove(java.lang.Object key)
Remove the object stored under the key specified. |
void |
removeAll()
Remove all objects from the cache. |
void |
removeListener(CachePolicyListener listener)
Remove a listener from this cache policy. |
Method Detail |
---|
void put(java.lang.Object key, java.lang.Object value) throws CacheEvictionException
If the changes to the cache cause the eviction of any objects
stored under other key(s), events corresponding to
the evictions are fired for each object. If an event listener is
unable to handle the eviction, and throws a cache eviction exception,
that exception is propagated to the caller. If such an exception is
thrown, the cache itself should be left as it was before the
put()
operation was invoked: the the object whose
eviction failed is still in the cache, and the new insertion or
modification is reverted.
key
- key for the cached objectvalue
- the cached object
CacheEvictionException
- propagated if, while evicting objects
to make room for new object, an eviction listener encountered
this problem.java.lang.Object get(java.lang.Object key)
key
- key the object was cached under
void remove(java.lang.Object key)
put( )
).
key
- key the object was stored in the cache under.void removeAll()
remove( )
, no eviction notices are fired.
java.util.Enumeration elements()
void addListener(CachePolicyListener listener) throws java.lang.IllegalArgumentException
If this cache policy already contains a listener that is equal to the one being added, this call has no effect.
listener
- the (non-null) listener to add to this policy
java.lang.IllegalArgumentException
- if listener is null.void removeListener(CachePolicyListener listener)
listener
- the listener to remove from this policy
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |