Interface Cache.Listener
-
- All Known Subinterfaces:
CacheEvictor
- All Known Implementing Classes:
CachedRegionTracker
,LeastRecentlyUsedCacheEvictor
,NoOpCacheEvictor
- Enclosing interface:
- Cache
public static interface Cache.Listener
Listener ofCache
events.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onSpanAdded(Cache cache, CacheSpan span)
Called when aCacheSpan
is added to the cache.void
onSpanRemoved(Cache cache, CacheSpan span)
Called when aCacheSpan
is removed from the cache.void
onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
Called when an existingCacheSpan
is touched, causing it to be replaced.
-
-
-
Method Detail
-
onSpanAdded
void onSpanAdded(Cache cache, CacheSpan span)
Called when aCacheSpan
is added to the cache.- Parameters:
cache
- The source of the event.span
- The addedCacheSpan
.
-
onSpanRemoved
void onSpanRemoved(Cache cache, CacheSpan span)
Called when aCacheSpan
is removed from the cache.- Parameters:
cache
- The source of the event.span
- The removedCacheSpan
.
-
onSpanTouched
void onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
Called when an existingCacheSpan
is touched, causing it to be replaced. The newCacheSpan
is guaranteed to represent the same data as the one it replaces, howeverCacheSpan.file
andCacheSpan.lastTouchTimestamp
may have changed.Note that for span replacement,
onSpanAdded(Cache, CacheSpan)
andonSpanRemoved(Cache, CacheSpan)
are not called in addition to this method.
-
-