public interface CacheAdapter
Clients should implement this interface and call setCacheAdapter on the Cache with an instance of their class.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getCacheElement(java.lang.Object key)
Gets the element to be stored in the cache with the given key.
|
java.lang.Object[] |
getCacheElements(java.lang.Object[] keys)
Returns the array of elements corresponding to the given array of
keys.
|
int |
getCacheElementSize(java.lang.Object element,
java.lang.Object key)
Returns the approximate size in bytes of the given cache
element.
|
int |
getCacheKeySize(java.lang.Object key)
Returns the approximate size in bytes of the given cache key.
|
void |
removeCacheElement(java.lang.Object element,
java.lang.Object key)
This method is called by the synchronized method Cache.remove to
allow the adapter to do any related clean up, if necessary, when
an element is removed from the cache.
|
static final java.lang.String CLASS_VERSION
java.lang.Object getCacheElement(java.lang.Object key) throws java.lang.Exception
key
- the key to get a value forjava.lang.Exception
- if some form of exception occurs while
attempting to retrieve the element (e.g., SQLException). Since
the type of exceptions possible depend upon the implementation of
the adapter, the interface allows for generic exceptions.java.lang.Object[] getCacheElements(java.lang.Object[] keys) throws java.lang.Exception
java.lang.Exception
- if some form of exception occurs while
attempting to retrieve the elements (e.g., SQLException). Since
the type of exceptions possible depend upon the implementation of
the adapter, the interface allows for generic exceptions.int getCacheKeySize(java.lang.Object key)
int getCacheElementSize(java.lang.Object element, java.lang.Object key)
void removeCacheElement(java.lang.Object element, java.lang.Object key)