Package net.handle.hdllib
Class MemCache
java.lang.Object
net.handle.hdllib.MemCache
- All Implemented Interfaces:
Cache
Class used to cache values in a local database file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all values from the cachevoidclose()byte[][]getCachedValues(byte[] handle, byte[][] reqTypes, int[] reqIndexes) Returns any non-expired handle values that are in the caches storage.booleanisCachedNotFound(byte[][] values) Returns true if this return value of getCachedValues indicates a cached value of HANDLE_NOT_FOUNDvoidremoveHandle(byte[] handle) Remove one handle from the cachevoidsetCachedNotFound(byte[] handle, int ttl) Returns true if this handle should have a cached HANDLE_NOT_FOUND.voidsetCachedValues(byte[] handle, HandleValue[] newValues, byte[][] newTypeList, int[] newIndexList) Store the given handle values after a query for the handle.voidsetMaximumHandles(int maxHandles) Set the maximum size for the cache by the number of handles.voidsetMaximumSize(int maxSize) Set the maximum size for the cache by the number of bytes used for storage.
-
Constructor Details
-
MemCache
public MemCache(int maxHandles, long maxTTL) -
MemCache
Deprecated. -
MemCache
public MemCache(long maxTTL) -
MemCache
public MemCache()
-
-
Method Details
-
isCachedNotFound
public boolean isCachedNotFound(byte[][] values) Description copied from interface:CacheReturns true if this return value of getCachedValues indicates a cached value of HANDLE_NOT_FOUND- Specified by:
isCachedNotFoundin interfaceCache
-
getCachedValues
public byte[][] getCachedValues(byte[] handle, byte[][] reqTypes, int[] reqIndexes) throws Exception Returns any non-expired handle values that are in the caches storage. A null return value indicates that the requested values aren't in the cache. Returning the an array of values (including an array of zero length) indicates that the returned values are the only values from the requested set (ie the handle doesn't have any more values from the requested set). ***** Speed is important in this method *****- Specified by:
getCachedValuesin interfaceCache- Throws:
Exception
-
setCachedNotFound
Description copied from interface:CacheReturns true if this handle should have a cached HANDLE_NOT_FOUND. Pass time-to-live.- Specified by:
setCachedNotFoundin interfaceCache- Throws:
Exception
-
removeHandle
Description copied from interface:CacheRemove one handle from the cache- Specified by:
removeHandlein interfaceCache- Throws:
Exception
-
setCachedValues
public void setCachedValues(byte[] handle, HandleValue[] newValues, byte[][] newTypeList, int[] newIndexList) throws Exception Store the given handle values after a query for the handle. The query was performed with the given type-list and index-list. ***** Speed is less important in this method *****- Specified by:
setCachedValuesin interfaceCache- Throws:
Exception
-
clear
Remove all values from the cache -
setMaximumHandles
public void setMaximumHandles(int maxHandles) Set the maximum size for the cache by the number of handles.- Specified by:
setMaximumHandlesin interfaceCache
-
setMaximumSize
public void setMaximumSize(int maxSize) Set the maximum size for the cache by the number of bytes used for storage.- Specified by:
setMaximumSizein interfaceCache
-
close
public void close()
-