-
- All Implemented Interfaces:
-
com.facebook.cache.common.CacheEvent
public class SettableCacheEvent implements CacheEvent
Implementation of CacheEvent that allows the values to be set and supports recycling of instances.
-
-
Method Summary
Modifier and Type Method Description static SettableCacheEventobtain()CacheKeygetCacheKey()Gets the cache key related to this event. SettableCacheEventsetCacheKey(CacheKey cacheKey)StringgetResourceId()Gets the resource ID for the cached item. SettableCacheEventsetResourceId(String resourceId)longgetItemSize()Gets the size of the new resource in storage, in bytes. SettableCacheEventsetItemSize(long itemSize)longgetCacheSize()Gets the total size of the resources currently in storage, in bytes. SettableCacheEventsetCacheSize(long cacheSize)longgetCacheLimit()Gets the current size limit for the cache, in bytes. SettableCacheEventsetCacheLimit(long cacheLimit)IOExceptiongetException()Gets the exception which occurred to trigger a read or write exception event. SettableCacheEventsetException(IOException exception)CacheEventListener.EvictionReasongetEvictionReason()Gets the reason for an item's eviction in eviction events. SettableCacheEventsetEvictionReason(CacheEventListener.EvictionReason evictionReason)voidrecycle()-
-
Method Detail
-
obtain
static SettableCacheEvent obtain()
-
getCacheKey
@Nullable() CacheKey getCacheKey()
Gets the cache key related to this event.
This should be present for all events other than eviction.
-
setCacheKey
SettableCacheEvent setCacheKey(CacheKey cacheKey)
-
getResourceId
@Nullable() 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.
-
setResourceId
SettableCacheEvent setResourceId(String resourceId)
-
getItemSize
long getItemSize()
Gets the size of the new resource in storage, in bytes.
This is present in write success and eviction events.
-
setItemSize
SettableCacheEvent setItemSize(long itemSize)
-
getCacheSize
long getCacheSize()
Gets the total size of the resources currently in storage, in bytes.
This is present in write success and eviction events.
-
setCacheSize
SettableCacheEvent setCacheSize(long cacheSize)
-
getCacheLimit
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.
-
setCacheLimit
SettableCacheEvent setCacheLimit(long cacheLimit)
-
getException
@Nullable() IOException getException()
Gets the exception which occurred to trigger a read or write exception event.
-
setException
SettableCacheEvent setException(IOException exception)
-
getEvictionReason
@Nullable() CacheEventListener.EvictionReason getEvictionReason()
Gets the reason for an item's eviction in eviction events.
-
setEvictionReason
SettableCacheEvent setEvictionReason(CacheEventListener.EvictionReason evictionReason)
-
recycle
void recycle()
-
-
-
-