|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrabbit.cache.NCache
public class NCache
The NCache is like a Map in lookup/insert/delete The NCache is persistent over sessions (saves itself to disk). The NCache is selfcleaning, that is it removes old stuff.
Constructor Summary | |
---|---|
NCache()
Create a cache that uses default values. |
|
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 |
entryChanged(NCacheEntry ent)
Signal that a cache entry have changed. |
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. |
int |
getCleanLoopTime()
Get how long time the cleaner sleeps between cleanups. |
long |
getCurrentSize()
Get the current size of the cache |
java.util.Collection<NCacheEntry> |
getEntries()
Get the CacheEntries in the cache. |
NCacheEntry |
getEntry(java.lang.Object o)
Get the CacheEntry assosiated with given object. |
java.lang.String |
getEntryName(long id,
boolean real)
Get the file name for a cache entry. |
java.lang.String |
getEntryName(NCacheEntry ent)
Get the file name for a real cache entry. |
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 |
setCleanLoopTime(int newCleanLoopTime)
Set how long time the cleaner sleeps between cleanups. |
void |
setMaxSize(long newMaxSize)
Set the maximum size for this cache. |
void |
setup(SProperties config)
Configure the cache system from the given config. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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 int getCleanLoopTime()
public void setCleanLoopTime(int newCleanLoopTime)
newCleanLoopTime
- the number of miliseconds to sleep.public long getCurrentSize()
public long getNumberOfEntries()
public NCacheEntry getEntry(java.lang.Object o)
o
- the key.
public java.lang.String getEntryName(NCacheEntry ent)
public java.lang.String getEntryName(long id, boolean real)
id
- the id of the cache entryreal
- false if this is a temporary cache file, true if it is a realized entry.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 entryChanged(NCacheEntry ent)
public void remove(java.lang.Object o)
o
- the key for the CacheEntry.public void clear()
public java.util.Collection<NCacheEntry> getEntries()
public void flush()
public void run()
run
in interface java.lang.Runnable
public void setup(SProperties config) throws IllegalConfigurationException
config
- the properties 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 |