docs/doc/reference/com/google/android/exoplayer2/upstream/cache/Cache.Listener.html
Package com.google.android.exoplayer2.upstream.cache
CacheEvictorAll Known Implementing Classes:CachedRegionTracker, LeastRecentlyUsedCacheEvictor, NoOpCacheEvictorEnclosing interface:Cachepublic static interfaceCache.Listener
Listener of Cache events.
All Methods Instance Methods Abstract Methods | Modifier and Type | Method | 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 touched, causing it to be replaced.
|
-
void onSpanAdded([Cache](Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[CacheSpan](CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")span)
Called when a CacheSpan is added to the cache.
Parameters:cache - The source of the event.span - The added CacheSpan.
-
void onSpanRemoved([Cache](Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[CacheSpan](CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")span)
Called when a CacheSpan is removed from the cache.
Parameters:cache - The source of the event.span - The removed CacheSpan.
-
void onSpanTouched([Cache](Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[CacheSpan](CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")oldSpan,[CacheSpan](CacheSpan.html "class in com.google.android.exoplayer2.upstream.cache")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 CacheSpan.file and CacheSpan.lastTouchTimestamp may have changed.
Note that for span replacement, onSpanAdded(Cache, CacheSpan) and onSpanRemoved(Cache, CacheSpan) are not called in addition to this method.
Parameters:cache - The source of the event.oldSpan - The old CacheSpan, which has been removed from the cache.newSpan - The new CacheSpan, which has been added to the cache.