public interface Cache.Listener

Known direct subclasses
CacheEvictor

Evicts data from a Cache.

CachedRegionTracker

Utility class for efficiently tracking regions of data that are stored in a Cache for a given cache key.

Known indirect subclasses
LeastRecentlyUsedCacheEvictor

Evicts least recently used cache files first.

NoOpCacheEvictor

Evictor that doesn't ever evict cache files.


Listener of Cache events.

Summary

Public methods

abstract void
onSpanAdded(Cache cache, CacheSpan span)

Called when a CacheSpan is added to the cache.

abstract void
onSpanRemoved(Cache cache, CacheSpan span)

Called when a CacheSpan is removed from the cache.

abstract void
onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)

Called when an existing CacheSpan is touched, causing it to be replaced.

Public methods

onSpanAdded

abstract void onSpanAdded(Cache cache, CacheSpan span)

Called when a CacheSpan is added to the cache.

Parameters
Cache cache

The source of the event.

CacheSpan span

The added CacheSpan.

onSpanRemoved

abstract void onSpanRemoved(Cache cache, CacheSpan span)

Called when a CacheSpan is removed from the cache.

Parameters
Cache cache

The source of the event.

CacheSpan span

The removed CacheSpan.

onSpanTouched

abstract void onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)

Called when an existing CacheSpan is touched, causing it to be replaced. The new CacheSpan is guaranteed to represent the same data as the one it replaces, however file and lastTouchTimestamp may have changed.

Note that for span replacement, onSpanAdded and onSpanRemoved are not called in addition to this method.

Parameters
Cache cache

The source of the event.

CacheSpan oldSpan

The old CacheSpan, which has been removed from the cache.

CacheSpan newSpan

The new CacheSpan, which has been added to the cache.