|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the general interface to model an object cache. This provides the methods to store and retrieve an object based on a key.
Method Summary | |
void |
addCacheListener(CacheListener listener)
This enables to add a CacheListener to the Cache. |
void |
clear()
Removes all the objects from the Cache, leaving it empty. |
java.lang.Object[] |
getAllObjects()
|
java.lang.Object[] |
getAllObjects(java.lang.Class type)
This is a convenience method to ensure that the array returned if has member of the correct type. |
CacheListener[] |
getCacheListeners()
|
java.util.Map |
getMap()
This method enables to access to the cache contents. |
int |
getMaxSize()
|
java.lang.Object |
getObject(java.lang.Object key)
|
CachePolicy |
getReplacementPolicy()
|
int |
getSize()
|
void |
registerAllObjects(java.util.Map m)
This is a convenience method. |
void |
registerObject(java.lang.Object key,
java.lang.Object value)
Registers an object in the cache using the given key to refer to it. |
void |
removeCacheListener(CacheListener listener)
This enables to remove a CacheListener to the Cache. |
void |
setMaxSize(int maxSize)
Sets the maximum number of objects that will be stored in this cache. |
void |
unregisterObject(java.lang.Object key)
Removes the object associated with the given key from the Cache. |
Method Detail |
public void setMaxSize(int maxSize)
maxSize
- the maximum size.public CachePolicy getReplacementPolicy()
public void registerObject(java.lang.Object key, java.lang.Object value) throws CacheFullException
key
- the key to use to retrieve the object.value
- the object to store in the Cache.
CacheFullException
- when the Cache would exceed its maximum size and no room can
be made.public void unregisterObject(java.lang.Object key)
key
- the key associated to the object to be removed.public java.lang.Object getObject(java.lang.Object key)
key
- the key associated to the object to be retrieved.
public int getMaxSize()
public java.lang.Object[] getAllObjects()
public java.lang.Object[] getAllObjects(java.lang.Class type)
type
- the type to assign to the array (this should be a type common
to all the objects contained in the Cache.
public void registerAllObjects(java.util.Map m) throws CacheFullException
m
- the map that contains the objects (and keys) to use.
CacheFullException
- when the Cache would exceed its maximum size and no room can
be made.public java.util.Map getMap()
public void clear()
public int getSize()
public void addCacheListener(CacheListener listener)
listener
- the listener to add.public void removeCacheListener(CacheListener listener)
listener
- the listener to remove.public CacheListener[] getCacheListeners()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |