| java.lang.Object com.hp.hpl.jena.db.impl.SimpleCache
SimpleCache | public class SimpleCache implements ICache(Code) | | Trivial implementation of the generic cache interface used to cache
literals and resources. This implementation simple flushes the cache
when the threshold limit is exceeded.
author: Dave Reynolds version: $Revision: 1.8 $ on $Date: 2008/01/02 12:08:25 $ |
Constructor Summary | |
public | SimpleCache(int threshold) Create an empty cache with the given threshold limit. |
Method Summary | |
public Object | get(IDBID id) | public int | getLimit() Return the current threshold limit for the cache size. | public void | put(IDBID id, Object val) | public void | setLimit(int threshold) Set a threshold for the cache size in terms of the count of cache entries. |
cache | protected Map cache(Code) | | The cache itself
|
count | protected int count(Code) | | The current number of entries (probably redundant, just use cache.size)
|
threshold | protected int threshold(Code) | | The current size limit
|
SimpleCache | public SimpleCache(int threshold)(Code) | | Create an empty cache with the given threshold limit.
Parameters: threshold - the cache size limit, use 0 for no cache, -1 forunlimited cache growth; any other number indicates the number of cache entries |
get | public Object get(IDBID id)(Code) | | Retreive an object from the cache
Parameters: id - the database ID of the object to be retrieved the object or null if it is not in the cache |
getLimit | public int getLimit()(Code) | | Return the current threshold limit for the cache size.
|
put | public void put(IDBID id, Object val)(Code) | | Add an entry to the cache
Parameters: id - the database ID to be used as an index Parameters: val - the literal or resources to be stored |
setLimit | public void setLimit(int threshold)(Code) | | 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 forunlimited cache growth; any other number indicates the number of cache entries |
|
|