Back to Exoplayer

Cache.Listener (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/upstream/cache/Cache.Listener.html

latest3.8 KB
Original Source

Package com.google.android.exoplayer2.upstream.cache

Interface Cache.Listener

  • All Known Subinterfaces:CacheEvictorAll Known Implementing Classes:CachedRegionTracker, LeastRecentlyUsedCacheEvictor, NoOpCacheEvictorEnclosing interface:Cache

public static interfaceCache.Listener

Listener of Cache events.

Method Summary

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. |

Method Detail

- 

onSpanAdded

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.

- 

onSpanRemoved

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.

- 

onSpanTouched

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.