public interface MultipleObjectCacheManager
UnsupportedOperationException
.
ObjectCacheManager
but each method (where appropriate)
takes a key object to tell the implementing class which cache it wants the operation
to occur on.Modifier and Type | Method and Description |
---|---|
int |
capacity(java.lang.Object key)
Return the current capacity of the cache, it should basically be (max size - current size).
|
void |
flush(java.lang.Object key)
Let the object cache be flushed.
|
boolean |
isEmpty(java.lang.Object key)
Return whether the cache is empty or not.
|
void |
merge(java.lang.Object key,
ObjectCache cache)
Merge the current cache with another.
|
void |
putAll(java.lang.Object key,
java.util.Map map)
Add all the entries in the Map to cache.
|
void |
resize(java.lang.Object key,
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(java.lang.Object key,
int size)
Set the maximum size of the cache.
|
void |
setPolicy(java.lang.Object key,
int policy)
Set the policy for managing the cache, should be one of:
ObjectCache.OLDEST , ObjectCache.YOUNGEST , ObjectCache.RANDOM . |
void |
toMap(java.lang.Object object,
java.util.Map map)
Get all the entries in the cache as a Map of key to value.
|
void flush(java.lang.Object key)
key
- The key to identify the particular cache.void setMaxSize(java.lang.Object key, int size)
key
- The key to identify the particular cache.size
- The maximum size.void resize(java.lang.Object key, int size)
key
- The key to identify the particular cache.size
- The new size.int capacity(java.lang.Object key)
key
- The key to identify the particular cache.boolean isEmpty(java.lang.Object key)
key
- The key to identify the particular cache.true
if the cache is empty, false
if it has entries.void toMap(java.lang.Object object, java.util.Map map)
key
- The key to identify the particular cache.map
- The Map that should be populated with the key/values in the cache.void merge(java.lang.Object key, ObjectCache cache)
key
- The key to identify the particular cache.cache
- The cache to merge.void putAll(java.lang.Object key, java.util.Map map)
key
- The key to identify the particular cache.map
- The Map to get key/values from.void setPolicy(java.lang.Object key, int policy)
ObjectCache.OLDEST
, ObjectCache.YOUNGEST
, ObjectCache.RANDOM
.key
- The key to identify the particular cache.policy
- The policy.