scone.netobjects
Class CacheTable

java.lang.Object
  extended by scone.netobjects.CacheTable

public class CacheTable
extends java.lang.Object

A CacheTable is used to cache the entries of the database.

Author:
Harald Weinreich, Volkert Buchmann

Field Summary
protected  java.lang.String cacheName
           
protected  scone.netobjects.CacheTable.Cleaner cleaner
           
static boolean DEBUG
           
static int EAGERGC
           
protected  java.util.Hashtable[] entities
           
protected  int gcType
           
static int LAZYGC
           
protected  java.lang.Object lock
           
protected  int noOfKeys
           
protected  int timeTillCleanUp
           
 
Constructor Summary
CacheTable(java.lang.String cacheName, int noOfKeys, int timeTillCleanUp, int gcType)
          Create a new CacheTable with noOfKeys HashTables to access Data.
CacheTable(java.lang.String cacheName, int noOfKeys, int timeTillCleanUp, int gcType, int capacity)
          Create a new CacheTable with noOfKeys HashTables to access Data.
 
Method Summary
 void clean()
          Clean is called to store all elements of the cache to the database.
 Cacheable get(int keyNo, java.lang.Object key)
          get an Object from the Cache
 void put(Cacheable entity)
          Put an entity into CacheTable
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAZYGC

public static final int LAZYGC
See Also:
Constant Field Values

EAGERGC

public static final int EAGERGC
See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values

cacheName

protected java.lang.String cacheName

lock

protected java.lang.Object lock

entities

protected java.util.Hashtable[] entities

noOfKeys

protected int noOfKeys

gcType

protected int gcType

timeTillCleanUp

protected int timeTillCleanUp

cleaner

protected scone.netobjects.CacheTable.Cleaner cleaner
Constructor Detail

CacheTable

public CacheTable(java.lang.String cacheName,
                  int noOfKeys,
                  int timeTillCleanUp,
                  int gcType)
Create a new CacheTable with noOfKeys HashTables to access Data. Default capacity is 5000 Objects.

Parameters:
cacheName - name of the cache, i.e., cached objects.
noOfKeys - how many keys are
timeTillCleanUp - time between storing cache data
int - gcType this value is either LAZYGC: objects are removed if memory runs out or with EAGERGC as soon as possible

CacheTable

public CacheTable(java.lang.String cacheName,
                  int noOfKeys,
                  int timeTillCleanUp,
                  int gcType,
                  int capacity)
Create a new CacheTable with noOfKeys HashTables to access Data.

Parameters:
cacheName - name of the cache, i.e., cached objects.
noOfKeys - how many keys are
timeTillCleanUp - time between storing cache data
int - gcType this value is either LAZYGC: objects are removed if memory runs out or with EAGERGC as soon as possible
int - capacity initial capacity of cache for this type of objects...
Method Detail

shutdown

public void shutdown()

put

public void put(Cacheable entity)
Put an entity into CacheTable

Parameters:
entity - the object to be saved in cache.

get

public Cacheable get(int keyNo,
                     java.lang.Object key)
get an Object from the Cache

Parameters:
keyNo - the number of the key to acces the entry
key - the key associated with the object.

clean

public void clean()
Clean is called to store all elements of the cache to the database.