|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.ucsb.adl.middleware.ReportCache
Caches reports for a metadata view for a collection. The cache is implemented as a Berkeley DB database. The database may reside in a dedicated directory (or "environment" in Berkeley DB parlance) or it may share a directory with other databases.
Note: it is possible for two middleware instances running in the same JVM to share a cache (i.e., an instance of this class), specifically, when the two middleware instances specify the same cache directory and cache reports for two like-named collections. This behavior may or may not be desirable, depending on whether the two collections are really the same collection, or are distinct collections that just happen to have the same name.
$Log: ReportCache.java,v $ Revision 1.1 2006/06/23 20:42:38 gjanee Initial revision
| Method Summary | |
static edu.ucsb.adl.middleware.ReportCache |
createCache(java.lang.String cacheDirectory,
java.lang.String databaseName)
Creates a ReportCache. |
void |
destroy()
Decrements the reference count. |
void |
empty()
Empties the cache. |
java.lang.String |
get(java.lang.String holding)
Retrieves the cached report for a holding. |
void |
put(java.lang.String holding,
java.lang.String report)
Inserts the report for a holding in the cache. |
void |
sync()
Syncs the cache with persistent disk storage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static edu.ucsb.adl.middleware.ReportCache createCache(java.lang.String cacheDirectory,
java.lang.String databaseName)
throws InternalErrorException
ReportCache. If the Berkeley DB
database for the cache does not exist, it is created. (The
Berkeley DB environment, i.e., cache directory, must already
exist, but the database itself will be created if necessary.)
If a cache object already exists for the cache directory and
database name, the extant cache's reference count is
incremented and it is returned instead.
cacheDirectory - The cache's directory, which must already exist. The pathname
must be absolute.databaseName - The database name, e.g., "adl_catalog:adl:bucket".
ReportCache.
InternalErrorException - If any error is encountered.
public java.lang.String get(java.lang.String holding)
throws InternalErrorException
holding - The holding identifier, e.g., "1001652".
null if the report is not in the
cache.
InternalErrorException - If any error occurs.
public void put(java.lang.String holding,
java.lang.String report)
throws InternalErrorException
holding - The holding identifier, e.g., "1001652".report - The metadata report.
InternalErrorException - If any error occurs.
public void empty()
throws InternalErrorException
InternalErrorException - If any error occurs. Regrettably, an exception unavoidably
leaves the cache in an unusable state.
public void sync()
throws InternalErrorException
InternalErrorException - If any error occurs.public void destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||