|
common-util | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlocal.tomas.util.cache.CacheMap<K,V>
K - type of object keyV - type of objectspublic class CacheMap<K,V>
A fixed size cache of objects.
| Constructor Summary | |
|---|---|
CacheMap(CacheBackend<K,V> backend)
Construct cache with specified backend and a default size of 1000. |
|
CacheMap(CacheBackend<K,V> backend,
int cacheSize)
Construct cache with specified backend and size. |
|
| Method Summary | |
|---|---|
protected void |
finalize()
|
V |
get(K key)
Get object by key. |
V |
getOrCreate(K key)
Get object by key or create new object if it does not exist. |
void |
load()
Load objects from backend. |
void |
put(K key,
V value)
Put object into cache. |
void |
remove(K key)
Remove object from cache. |
void |
unload()
Save all object in backend. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CacheMap(CacheBackend<K,V> backend,
int cacheSize)
backend - the backendcacheSize - the sizepublic CacheMap(CacheBackend<K,V> backend)
backend - the backend| Method Detail |
|---|
public V get(K key)
throws CacheException
key - the key
CacheException - on backend exceptions
public void put(K key,
V value)
throws CacheException
key - object keyvalue - object value
CacheException - on backend exceptions
public V getOrCreate(K key)
throws CacheException
key - object key
CacheException - on backend exceptions
public void remove(K key)
throws CacheException
key - object key
CacheException - on backend exceptions
public void load()
throws CacheException
CacheException - on backend exceptions
public void unload()
throws CacheException
CacheException - on backend exceptions
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
common-util | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||