|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectCacheManager
This interface should be implemented by classes that contain a publicly available
ObjectCache, it provides methods that allow applications to control the cache without
understanding what is inside the cache.
All of the methods in this interface are optional and if not supported then
implementing classes should throw UnsupportedOperationException
.
Method Summary | |
---|---|
int |
capacity()
Return the current capacity of the cache, it should basically be (max size - current size). |
void |
flush()
Let the object cache be flushed. |
boolean |
isEmpty()
Return whether the cache is empty or not. |
void |
merge(ObjectCache cache)
Merge the current cache with another. |
void |
putAll(Map map)
Add all the entries in the Map to cache. |
void |
resize(int size)
Resize the cache to a particular size, if the size is actually bigger than the current size then this operation should not touch the cached objects, if the size is less then the cache should be reduced in size using the current policy until the size is reached. |
void |
setMaxSize(int size)
Set the maximum size of the cache. |
void |
setPolicy(int policy)
Set the policy for managing the cache, should be one of: ObjectCache.OLDEST , ObjectCache.YOUNGEST , ObjectCache.RANDOM . |
void |
toMap(Map map)
Get all the entries in the cache as a Map of key to value. |
Method Detail |
---|
void flush()
void setMaxSize(int size)
size
- The maximum size.void resize(int size)
size
- The new size.int capacity()
boolean isEmpty()
true
if the cache is empty, false
if it has entries.void toMap(Map map)
map
- The Map that should be populated with the key/values in the cache.void merge(ObjectCache cache)
cache
- The cache to merge.void putAll(Map map)
map
- The Map to get key/values from.void setPolicy(int policy)
ObjectCache.OLDEST
, ObjectCache.YOUNGEST
, ObjectCache.RANDOM
.
policy
- The policy.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |