com.knowgate.dataobjs
Class DBSubsetCache

java.lang.Object
  extended by com.knowgate.dataobjs.DBSubsetCache

public final class DBSubsetCache
extends java.lang.Object

Local Cache for DBSubset Objects


Nested Class Summary
 class DBSubsetCache.DBCacheEntry
           
 
Field Summary
 int iTopIndex
           
 int iUsed
           
 
Constructor Summary
DBSubsetCache()
          Default constructor Cache capacity is set to 100
DBSubsetCache(int iCapacity)
           
 
Method Summary
 int capacity()
          Get Maximum number of entries that cache can hold
 void clear()
          Clear cache
 void clear(java.lang.String sTable)
          Remove all entries from cache that are registers from a given table
 boolean expire(java.lang.String sKey)
          Remove a cache entry
 DBSubset get(java.lang.String sKey)
          Get DBSubset from cache
 DBSubsetCache.DBCacheEntry getEntry(java.lang.String sKey)
          Get DBCacheEntry from cache
 java.lang.String getKey(int iEntryIndex)
           
 void put(java.lang.String sTableName, java.lang.String sKey, DBSubset oDBSS)
          Add new entry to cache
 void replace(java.lang.String sTableName, java.lang.String sKey, DBSubset oDBSS)
          Replace a cache entry
 void setKey(java.lang.String sKey, int iEntryIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iTopIndex

public int iTopIndex

iUsed

public int iUsed
Constructor Detail

DBSubsetCache

public DBSubsetCache()

Default constructor

Cache capacity is set to 100


DBSubsetCache

public DBSubsetCache(int iCapacity)
Parameters:
iCapacity - Maximum number of entries that cache can hold
Method Detail

capacity

public int capacity()
Get Maximum number of entries that cache can hold


put

public void put(java.lang.String sTableName,
                java.lang.String sKey,
                DBSubset oDBSS)
Add new entry to cache

Parameters:
sTableName - Associated table (optional)
sKey - Unique key for cache entry
oDBSS - Stored DBSubset

expire

public boolean expire(java.lang.String sKey)
Remove a cache entry

Parameters:
sKey - Unique key for cache entry
Returns:
true if cache already contained an entry with given key, false if no entry was removed from cache.

replace

public void replace(java.lang.String sTableName,
                    java.lang.String sKey,
                    DBSubset oDBSS)
Replace a cache entry

Parameters:
sTableName - Associated table (optional)
sKey - Unique key for cache entry
oDBSS - New DBSubset to be stored

clear

public void clear()
Clear cache


clear

public void clear(java.lang.String sTable)
Remove all entries from cache that are registers from a given table

Parameters:
sTable - Table Name

get

public DBSubset get(java.lang.String sKey)
Get DBSubset from cache

Parameters:
sKey - Unique key for cache entry
Returns:
DBSubset reference or null

getEntry

public DBSubsetCache.DBCacheEntry getEntry(java.lang.String sKey)
Get DBCacheEntry from cache

Parameters:
sKey - Unique key for cache entry
Returns:
DBCacheEntry reference or null

getKey

public java.lang.String getKey(int iEntryIndex)

setKey

public void setKey(java.lang.String sKey,
                   int iEntryIndex)