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.


Variable Index

 o READEXCLUSIVE
 o READSHARED
 o WRITEEXCLUSIVE
 o WRITESHARED

Constructor Index

 o NodeCache(Node, int, int)

Method Index

 o clean()
clean the cache of expired objects
 o get(byte[], Object)
get another protocols's object from the cache
 o get(Object)
get an object from the cache by its key
 o getAccess(Object)
get the access flags of an object in the cache by its key
 o main(String[])
lots of gratuitous testing
 o put(Object, Object, int)
put an object in the cache by key, with duration and default access
 o put(Object, Object, int, int)
put an object in the cache by key, with duration and access
 o remove(Object)
remove an object from the cache by its key
 o run()
 o setAccess(Object, int)
set the access flags of an object in the cache by its key
 o toString()
mainly for testing

Variables

 o READSHARED
 public static final int READSHARED
 o READEXCLUSIVE
 public static final int READEXCLUSIVE
 o WRITESHARED
 public static final int WRITESHARED
 o WRITEEXCLUSIVE
 public static final int WRITEEXCLUSIVE

Constructors

 o NodeCache
 public NodeCache(Node owner,
                  int capacity,
                  int duration)

Methods

 o getAccess
 public synchronized int getAccess(Object key)
get the access flags of an object in the cache by its key

 o setAccess
 public synchronized boolean setAccess(Object key,
                                       int access)
set the access flags of an object in the cache by its key

 o get
 public synchronized Object get(Object key)
get an object from the cache by its key

 o get
 public synchronized Object get(byte protocol[],
                                Object key)
get another protocols's object from the cache

 o 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

 o 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

 o remove
 public synchronized Object remove(Object key)
remove an object from the cache by its key

 o clean
 public synchronized void clean()
clean the cache of expired objects

 o toString
 public synchronized String toString()
mainly for testing

Overrides:
toString in class Object
 o run
 public void run()
 o main
 public static void main(String args[]) throws Exception
lots of gratuitous testing


All Packages  Class Hierarchy  This Package  Previous  Next  Index