public static interface Cache.Listener
Cache
events.Modifier and Type | Method and Description |
---|---|
void |
onSpanAdded(Cache cache,
CacheSpan span)
Called when a
CacheSpan is added to the cache. |
void |
onSpanRemoved(Cache cache,
CacheSpan span)
Called when a
CacheSpan is removed from the cache. |
void |
onSpanTouched(Cache cache,
CacheSpan oldSpan,
CacheSpan newSpan)
Called when an existing
CacheSpan is accessed, causing it to be replaced. |
void onSpanAdded(Cache cache, CacheSpan span)
CacheSpan
is added to the cache.cache
- The source of the event.span
- The added CacheSpan
.void onSpanRemoved(Cache cache, CacheSpan span)
CacheSpan
is removed from the cache.cache
- The source of the event.span
- The removed CacheSpan
.void onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
CacheSpan
is accessed, causing it to be replaced. The new
CacheSpan
is guaranteed to represent the same data as the one it replaces, however
CacheSpan.file
and CacheSpan.lastAccessTimestamp
may have changed.
Note that for span replacement, onSpanAdded(Cache, CacheSpan)
and
onSpanRemoved(Cache, CacheSpan)
are not called in addition to this method.