|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--rabbit.cache.NCache
The NCache is like a Hashtable in lookup/insert/delete The NCache is persistent over sessions (saves itself to disk). The NCache is selfcleaning, that is it removes old stuff.
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
NCache()
Create a cache that uses some dir. |
|
NCache(java.lang.String dir)
Create a cache for the given directory. |
|
NCache(java.lang.String dir,
long maxSize)
Create a cache for the given directory with given parameters. |
|
NCache(java.lang.String dir,
long maxSize,
long cacheTime)
Create a cachehandler. |
Method Summary | |
void |
addEntry(NCacheEntry ent)
Insert a CacheEntry into the cache. |
void |
clear()
Clear the Cache from files. |
void |
flush()
Make sure that the cache is written to the disk. |
java.lang.String |
getCacheDir()
Get the name of the directory where the 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 |
java.util.Enumeration |
getEntries()
Get the CacheEntries in the cache. |
NCacheEntry |
getEntry(java.lang.Object o)
Get the CacheEntry assosiated with given object. |
long |
getMaxSize()
Get the maximum size for this cache. |
long |
getNumberOfEntries()
Get the current number of entries in the cache. |
NCacheEntry |
newEntry(java.lang.Object o)
Reserve space for a CacheEntry with key o. |
void |
remove(java.lang.Object o)
Remove the Entry with key o from the cache. |
void |
run()
Loop in a cleaning loop. |
void |
setCacheDir(java.lang.String newDir)
Sets the cachedir. |
void |
setCacheTime(long newCacheTime)
Set the standard expiry-time for CacheEntries |
void |
setMaxSize(long newMaxSize)
Set the maximum size for this cache. |
void |
setup(java.util.Properties config)
Configure the cache system from the given config. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NCache()
public NCache(java.lang.String dir)
dir
- the name of the directory where the cache should store its files.public NCache(java.lang.String dir, long maxSize)
dir
- the name of the directory where the cache should store its files.maxSize
- the maximum size of the proxy.public NCache(java.lang.String dir, long maxSize, long cacheTime)
dir
- the basedir for the cachehandler.maxSize
- the maximum size of the proxy.cacheTime
- how long the proxy should keep things unless specified otherwise.Method Detail |
public java.lang.String getCacheDir()
public void setCacheDir(java.lang.String newDir)
newDir
- the name of the new directory to use.public long getMaxSize()
public void setMaxSize(long newMaxSize)
newMaxSize
- the new maximum size for the cache.public long getCacheTime()
public void setCacheTime(long newCacheTime)
newCacheTime
- the number of miliseconds to keep objects normally.public long getCurrentSize()
public long getNumberOfEntries()
public NCacheEntry getEntry(java.lang.Object o)
o
- the key.
public NCacheEntry newEntry(java.lang.Object o)
o
- the key for the NCacheEntry.
public void addEntry(NCacheEntry ent)
ent
- the CacheEntry to store.public void remove(java.lang.Object o)
o
- the key for the CacheEntry.public void clear()
public java.util.Enumeration getEntries()
public void flush()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void setup(java.util.Properties config) throws IllegalConfigurationException
config
- the Property describing the cache settings.
IllegalConfigurationException
- if some setting is strange.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |