org.xorm.cache
Interface DataCache

All Superinterfaces:
Configurable
All Known Implementing Classes:
HeapDatastore, LRUCache

public interface DataCache
extends Configurable

The interface for a XORM cache. The cache contains Row objects. It is up to an implementation to determine the cache strategy and layout. A cache is not required to hold a reference for any period of time. The only requirements are as follows:

The cache implementation may take arbitrary parameters specified in the JDO initialization properties set.


Method Summary
 void add(Row row)
          Adds or replaces the Row in the cache.
 Row get(Table table, Object primaryKey)
          Retrieves the Row from the cache with the matching primary key.
 void remove(Row row)
          Removes a Row from the cache by its primary key.
 
Methods inherited from interface org.xorm.Configurable
setFactory, setProperties
 

Method Detail

add

public void add(Row row)
Adds or replaces the Row in the cache. If the Table does not have a primary key defined, the implementation is not required to cache it.


get

public Row get(Table table,
               Object primaryKey)
Retrieves the Row from the cache with the matching primary key.

Returns:
a row matching the criteria, or null

remove

public void remove(Row row)
Removes a Row from the cache by its primary key. If no matching row exists, no change is made. Implementations of this method should use the .equals() operator for Row comparisons.



$Header: /cvsroot/xorm/xorm/docs/api/org/xorm/cache/DataCache.html,v 1.6 2004/05/30 08:55:04 wbiggs Exp $