org.glite.security.voms.database.cache
Class RowCache

java.lang.Object
  extended byorg.glite.security.voms.database.cache.RowCache

public final class RowCache
extends java.lang.Object

Row cache with size limit and multiple key support. Cacheables put in the cache

Author:
lorentey@elte.hu

Method Summary
static void clearAllCaches()
          Clear out all rowcaches, i.e., remove all cached objects.
 void expire(Cacheable c)
          Expire the given Cacheable, i.e., remove it from the cache.
 Cacheable get(java.lang.Object key)
          Return a slave Cacheable with the given key in this RowCache instance.
static RowCache getInstance(java.lang.String name, int maxsize)
          Get the named RowCache instance.
 Cacheable getQuick(java.lang.Object key)
          Return a slave Cacheable with the given key in this RowCache instance.
 void put(Cacheable c)
          Put the specified Cacheable row in the cache.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static RowCache getInstance(java.lang.String name,
                                   int maxsize)
Get the named RowCache instance. Use maxsize to set the cache size limit on initialization.


toString

public java.lang.String toString()

getQuick

public Cacheable getQuick(java.lang.Object key)
                   throws GeneralDatabaseException
Return a slave Cacheable with the given key in this RowCache instance. Allow the returned row to be slightly out of sync with the database, for potentially better performance. May return null if the row has not been put() in the cache yet.

Throws:
GeneralDatabaseException

get

public Cacheable get(java.lang.Object key)
              throws GeneralDatabaseException
Return a slave Cacheable with the given key in this RowCache instance. Make sure that the data reflects the current database contents. May return null if the row has not been put() in the cache yet.

Throws:
GeneralDatabaseException

put

public void put(Cacheable c)
Put the specified Cacheable row in the cache. The caller must destroy its reference to the Cacheable after this call.


expire

public void expire(Cacheable c)
Expire the given Cacheable, i.e., remove it from the cache. Called by Update.commit when the slave has been changed during the transaction.


clearAllCaches

public static void clearAllCaches()
Clear out all rowcaches, i.e., remove all cached objects.