All Packages Class Hierarchy This Package Previous Next Index
Class ants.NodeCache
java.lang.Object
|
+----ants.NodeCache
- public class NodeCache
- extends Object
- implements Runnable
node cache of managed soft-state
combines hashtable and doubly linked list to implement fixed size table
with LRU replacement. all public entry points are synchronized.
a background gc thread cleans entries that have expired.
-
READEXCLUSIVE
-
-
READSHARED
-
-
WRITEEXCLUSIVE
-
-
WRITESHARED
-
-
NodeCache(Node, int, int)
-
-
clean()
- clean the cache of expired objects
-
get(byte[], Object)
- get another protocols's object from the cache
-
get(Object)
- get an object from the cache by its key
-
getAccess(Object)
- get the access flags of an object in the cache by its key
-
main(String[])
- lots of gratuitous testing
-
put(Object, Object, int)
- put an object in the cache by key, with duration and default access
-
put(Object, Object, int, int)
- put an object in the cache by key, with duration and access
-
remove(Object)
- remove an object from the cache by its key
-
run()
-
-
setAccess(Object, int)
- set the access flags of an object in the cache by its key
-
toString()
- mainly for testing
READSHARED
public static final int READSHARED
READEXCLUSIVE
public static final int READEXCLUSIVE
WRITESHARED
public static final int WRITESHARED
WRITEEXCLUSIVE
public static final int WRITEEXCLUSIVE
NodeCache
public NodeCache(Node owner,
int capacity,
int duration)
getAccess
public synchronized int getAccess(Object key)
- get the access flags of an object in the cache by its key
setAccess
public synchronized boolean setAccess(Object key,
int access)
- set the access flags of an object in the cache by its key
get
public synchronized Object get(Object key)
- get an object from the cache by its key
get
public synchronized Object get(byte protocol[],
Object key)
- get another protocols's object from the cache
put
public final synchronized Object put(Object key,
Object value,
int time)
- put an object in the cache by key, with duration and default access
put
public synchronized Object put(Object key,
Object value,
int time,
int access)
- put an object in the cache by key, with duration and access
remove
public synchronized Object remove(Object key)
- remove an object from the cache by its key
clean
public synchronized void clean()
- clean the cache of expired objects
toString
public synchronized String toString()
- mainly for testing
- Overrides:
- toString in class Object
run
public void run()
main
public static void main(String args[]) throws Exception
- lots of gratuitous testing
All Packages Class Hierarchy This Package Previous Next Index