com.hp.hpl.mesa.rdf.jena.rdb
Interface ICache

All Known Implementing Classes:
SimpleCache

public interface ICache

Interface signature for cache implementations. Instances of this are used to cache resources and literals loaded from a database.

The type of the stored objects is left generic in case other caches are needed but could specialize it to RDFNodes.

Version:
$Revision: 1.1 $ on $Date: 2002/08/09 12:12:50 $
Author:
Dave Reynolds

Method Summary
 java.lang.Object get(IDBID id)
          Retreive an object from the cache
 int getLimit()
          Return the current threshold limit for the cache size.
 void put(IDBID id, java.lang.Object val)
          Add an entry to the cache
 void setLimit(int threshold)
          Set a threshold for the cache size in terms of the count of cache entries.
 

Method Detail

put

public void put(IDBID id,
                java.lang.Object val)
Add an entry to the cache

Parameters:
id - the database ID to be used as an index
val - the literal or resources to be stored

get

public java.lang.Object get(IDBID id)
Retreive an object from the cache

Parameters:
id - the database ID of the object to be retrieved
Returns:
the object or null if it is not in the cache

setLimit

public void setLimit(int threshold)
Set a threshold for the cache size in terms of the count of cache entries. For literals a storage limit rather than a count might be more useful but counts are easier, more general and sufficient for the current use.

Parameters:
threshold - the cache size limit, use 0 for no cache, -1 for unlimited cache growth; any other number indicates the number of cache entries

getLimit

public int getLimit()
Return the current threshold limit for the cache size.



Copyright © 2001 Hewlett-Packard. All Rights Reserved.