|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public 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. |
URL |
getCacheDir()
Get the location where this cache stores its files. |
long |
getCacheTime()
Get the number of miliseconds the cache stores things usually. |
long |
getCurrentSize()
Get the current size of the cache |
Collection<? extends CacheEntry<K,V>> |
getEntries()
Get the CacheEntries in the cache. |
CacheEntry<K,V> |
getEntry(K k)
Get the CacheEntry assosiated with given object. |
String |
getEntryName(long id,
boolean real,
String extension)
Get the file name for a cache entry. |
FileHandler<V> |
getHookFileHandler()
Get the file handler for the values. |
FileHandler<K> |
getKeyFileHandler()
Get the file handler for the keys. |
Logger |
getLogger()
Get the logger of this cache |
long |
getMaxSize()
Get the maximum size for 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 |
setCacheTime(long newCacheTime)
Set the standard expiry-time for CacheEntries |
void |
setMaxSize(long newMaxSize)
Set the maximum size for this cache. |
void |
stop()
Stop this cache. |
Method Detail |
---|
long getMaxSize()
void setMaxSize(long newMaxSize)
newMaxSize
- the new maximum size for the cache.long getCacheTime()
void setCacheTime(long newCacheTime)
newCacheTime
- the number of miliseconds to keep objects normally.long getCurrentSize()
long getNumberOfEntries()
URL getCacheDir()
CacheEntry<K,V> getEntry(K k) throws CacheException
k
- the key.
CacheException
String 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.FileHandler<K> getKeyFileHandler()
FileHandler<V> getHookFileHandler()
CacheEntry<K,V> newEntry(K k)
k
- the key for the CacheEntry.
void addEntry(CacheEntry<K,V> ent) throws CacheException
ent
- the CacheEntry to store.
CacheException
void entryChanged(CacheEntry<K,V> ent, K newKey, V newValue) throws CacheException
CacheException
void remove(K k) throws CacheException
k
- the key for the CacheEntry.
CacheException
void clear() throws CacheException
CacheException
Collection<? extends CacheEntry<K,V>> getEntries()
void flush()
void stop()
Logger getLogger()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |