-
public interface CacheEventInterface to provide details of an individual cache event.
All values may be null depending on the kind of event. See the docs for each method to see when to expect values to be available.
-
-
Method Summary
Modifier and Type Method Description abstract CacheKeygetCacheKey()Gets the cache key related to this event. abstract StringgetResourceId()Gets the resource ID for the cached item. abstract longgetItemSize()Gets the size of the new resource in storage, in bytes. abstract longgetCacheSize()Gets the total size of the resources currently in storage, in bytes. abstract longgetCacheLimit()Gets the current size limit for the cache, in bytes. abstract IOExceptiongetException()Gets the exception which occurred to trigger a read or write exception event. abstract CacheEventListener.EvictionReasongetEvictionReason()Gets the reason for an item's eviction in eviction events. -
-
Method Detail
-
getCacheKey
@Nullable() abstract CacheKey getCacheKey()
Gets the cache key related to this event.
This should be present for all events other than eviction.
-
getResourceId
@Nullable() abstract String getResourceId()
Gets the resource ID for the cached item.
This is present in cache hit, write success, read and write exceptions and evictions.
It may also be present in cache miss events if an ID was found in the cache's index but theresource wasn't then found in storage.
-
getItemSize
abstract long getItemSize()
Gets the size of the new resource in storage, in bytes.
This is present in write success and eviction events.
-
getCacheSize
abstract long getCacheSize()
Gets the total size of the resources currently in storage, in bytes.
This is present in write success and eviction events.
-
getCacheLimit
abstract long getCacheLimit()
Gets the current size limit for the cache, in bytes.
This is present in eviction events where the eviction is due to the need to trim for size.
-
getException
@Nullable() abstract IOException getException()
Gets the exception which occurred to trigger a read or write exception event.
-
getEvictionReason
@Nullable() abstract CacheEventListener.EvictionReason getEvictionReason()
Gets the reason for an item's eviction in eviction events.
-
-
-
-