com.adventnet.services.database
Class DBCacher

java.lang.Object
  |
  +--com.adventnet.services.database.DBCacher

class DBCacher
extends java.lang.Object

This class is used to Cache the values of the database table in the memory. Caching can be enabled in DatabaseAdaptor service as follows. DatabaseAdaptor dbservice = new DatabaseAdaptor(); dbservice.setCaching(true);


Constructor Summary
DBCacher()
          The default constructor.
DBCacher(int cachingTime, int cacheNumber)
           
 
Method Summary
 void delete(java.lang.Object[] indexArray)
          This method is called when any row is deleted.
 CompositeData getNextRow(java.lang.Object[] indexArray)
          This would return the CompositeData corresponding to the next row in the table after sorting identified by the index array.
 CompositeData getRow(java.lang.Object[] indexArray)
          This would return the CompositeData corresponding to the row specified by the index array in the table after sorting.
 void init(DatabaseHandler handler)
          This method is called internally by the DatabaseAdaptor.
(package private)  void timerComplete()
          This method will be called from the DBTimer class after the specified time has elapsed.
 void update(java.lang.Object[] indexArray)
          This method is called to update the values in the memory.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBCacher

public DBCacher()
The default constructor.

DBCacher

public DBCacher(int cachingTime,
                int cacheNumber)
Method Detail

init

public void init(DatabaseHandler handler)
This method is called internally by the DatabaseAdaptor.
Parameters:
The - DatabaseAdaptor reference.

getNextRow

public CompositeData getNextRow(java.lang.Object[] indexArray)
This would return the CompositeData corresponding to the next row in the table after sorting identified by the index array.
Returns:
The next entry as a CompositeData. null, if not cached.

getRow

public CompositeData getRow(java.lang.Object[] indexArray)
This would return the CompositeData corresponding to the row specified by the index array in the table after sorting.
Returns:
The entry as a CompositeData. null, if not cached.

update

public void update(java.lang.Object[] indexArray)
This method is called to update the values in the memory. This would be called when a SET is called or when a GET is done after the specified time interval.
Parameters:
The - index array corresponding to the SET or GET request.

delete

public void delete(java.lang.Object[] indexArray)
This method is called when any row is deleted.
Parameters:
The - index array corresponding to the deleteRow request.

timerComplete

void timerComplete()
This method will be called from the DBTimer class after the specified time has elapsed.