public interface ObjectCacheManager
UnsupportedOperationException
.Modifier and Type | Method and Description |
---|---|
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(java.util.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(java.util.Map map)
Get all the entries in the cache as a Map of key to value.
|
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(java.util.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(java.util.Map map)
map
- The Map to get key/values from.void setPolicy(int policy)
ObjectCache.OLDEST
, ObjectCache.YOUNGEST
, ObjectCache.RANDOM
.policy
- The policy.