|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the key type of the cacheV
- the data resourcepublic interface Cache<K,V>
A cache, mostly works like a map in lookup, insert and delete. A cache may be persistent over sessions. A cache may clean itself over time.
Method Summary | |
---|---|
void |
addEntry(CacheEntry<K,V> ent)
Insert a CacheEntry into the cache. |
void |
clear()
Clear the Cache from files. |
void |
entryChanged(CacheEntry<K,V> ent,
K newKey,
V newValue)
Signal that a cache entry have changed. |
void |
flush()
Make sure that the cache is written to the disk. |
CacheConfiguration |
getCacheConfiguration()
Get the cache configuration for this cache. |
long |
getCurrentSize()
Get the current size of the cache |
Iterable<? extends CacheEntry<K,V>> |
getEntries()
Get the CacheEntries in the cache. |
CacheEntry<K,V> |
getEntry(K k)
Get the CacheEntry assosiated with given object. |
File |
getEntryName(long id,
boolean real,
String extension)
Get the file name for a cache entry. |
Logger |
getLogger()
Get the logger of this cache |
long |
getNumberOfEntries()
Get the current number of entries in the cache. |
CacheEntry<K,V> |
newEntry(K k)
Reserve space for a CacheEntry with key o. |
void |
remove(K k)
Remove the Entry with key o from the cache. |
void |
start()
Start this cache. |
void |
stop()
Stop this cache. |
Method Detail |
---|
void start()
void stop()
CacheConfiguration getCacheConfiguration()
long getCurrentSize()
long getNumberOfEntries()
CacheEntry<K,V> getEntry(K k) throws CacheException
k
- the key.
CacheException
- upon failure to get the keyFile getEntryName(long id, boolean real, String extension)
id
- the id of the cache entryreal
- false if this is a temporary cache file,
true if it is a realized entry.extension
- the cache entry extension.
CacheEntry<K,V> newEntry(K k) throws CacheException
k
- the key for the CacheEntry.
CacheException
- upon failure to reserve a new entry.void addEntry(CacheEntry<K,V> ent) throws CacheException
ent
- the CacheEntry to store.
CacheException
- if adding the entry failsvoid entryChanged(CacheEntry<K,V> ent, K newKey, V newValue) throws CacheException
ent
- the CacheEntry that changednewKey
- the new key of the entrynewValue
- the new value
CacheException
- if updating the cache failsvoid remove(K k) throws CacheException
k
- the key for the CacheEntry.
CacheException
- if removal failsvoid clear() throws CacheException
CacheException
- if the clear operation failedIterable<? extends CacheEntry<K,V>> getEntries()
void flush()
Logger getLogger()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |