public class CacheMap extends Object
Constructor and Description |
---|
CacheMap()
Default constructor
|
CacheMap(String prefix)
Creates a cache map with a prefix string
|
Modifier and Type | Method and Description |
---|---|
void |
clearAllCache()
Clears the caches for this cache object
|
void |
clearMemoryCache()
Clears the memory cache
|
void |
clearStorageCache()
Clears the storage cache
|
void |
delete(Object key)
Deletes a cached entry
|
Object |
get(Object key)
Returns the object matching the given key
|
String |
getCachePrefix()
A prefix prepended to storage entries to differentiate them
|
int |
getCacheSize()
Indicates the size of the memory cache after which the cache won't grow further
Size is indicated by number of elements stored and not by KB or similar benchmark!
|
Vector |
getKeysInCache()
Returns the keys for all the objects currently in cache, this is useful
to traverse all the objects and refresh them without actually deleting
the cache and fetching them from scratch.
Important this vector is a copy of a current state, keys might not exist anymore or might change, others might be added in the interim. |
int |
getStorageCacheSize()
Indicates the size of the storage cache after which the cache won't grow further
Size is indicated by number of elements stored and not by KB or similar benchmark!
|
boolean |
isAlwaysStore()
When set to true indicates that all entries should be persisted to storage
for a constantly persisting cache
|
void |
put(Object key,
Object value)
Puts the given key/value pair in the cache
|
void |
setAlwaysStore(boolean alwaysStore)
When set to true indicates that all entries should be persisted to storage
for a constantly persisting cache
|
void |
setCachePrefix(String cachePrefix)
A prefix prepended to storage entries to differentiate them
|
void |
setCacheSize(int cacheSize)
Indicates the size of the memory cache after which the cache won't grow further
Size is indicated by number of elements stored and not by KB or similar benchmark!
|
void |
setStorageCacheSize(int storageCacheSize)
Indicates the size of the storage cache after which the cache won't grow further
Size is indicated by number of elements stored and not by KB or similar benchmark!
|
public CacheMap()
public CacheMap(String prefix)
prefix
- string to prepend to the cache entries in storagepublic int getCacheSize()
public void setCacheSize(int cacheSize)
cacheSize
- the cacheSize to setpublic void put(Object key, Object value)
key
- the keyvalue
- the valuepublic void delete(Object key)
key
- entry to remove from the cachepublic Object get(Object key)
key
- key objectpublic void clearAllCache()
public void clearMemoryCache()
public Vector getKeysInCache()
public void clearStorageCache()
public int getStorageCacheSize()
public void setStorageCacheSize(int storageCacheSize)
storageCacheSize
- the storageCacheSize to setpublic String getCachePrefix()
public void setCachePrefix(String cachePrefix)
cachePrefix
- the cachePrefix to setpublic boolean isAlwaysStore()
public void setAlwaysStore(boolean alwaysStore)
alwaysStore
- the alwaysStore to set