Class LeastRecentlyUsedCacheEvictor
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor
-
- All Implemented Interfaces:
Cache.Listener,CacheEvictor
@Deprecated public final class LeastRecentlyUsedCacheEvictor extends Object implements CacheEvictor
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.Evicts least recently used cache files first.
-
-
Constructor Summary
Constructors Constructor Description LeastRecentlyUsedCacheEvictor(long maxBytes)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidonCacheInitialized()Deprecated.Called when cache has been initialized.voidonSpanAdded(Cache cache, CacheSpan span)Deprecated.Called when aCacheSpanis added to the cache.voidonSpanRemoved(Cache cache, CacheSpan span)Deprecated.Called when aCacheSpanis removed from the cache.voidonSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)Deprecated.Called when an existingCacheSpanis touched, causing it to be replaced.voidonStartFile(Cache cache, String key, long position, long length)Deprecated.Called when a writer starts writing to the cache.booleanrequiresCacheSpanTouches()Deprecated.Returns whether the evictor requires theCacheto touchCacheSpanswhen it accesses them.
-
-
-
Method Detail
-
requiresCacheSpanTouches
public boolean requiresCacheSpanTouches()
Deprecated.Description copied from interface:CacheEvictorReturns whether the evictor requires theCacheto touchCacheSpanswhen it accesses them. Implementations that do not useCacheSpan.lastTouchTimestampshould returnfalse.- Specified by:
requiresCacheSpanTouchesin interfaceCacheEvictor
-
onCacheInitialized
public void onCacheInitialized()
Deprecated.Description copied from interface:CacheEvictorCalled when cache has been initialized.- Specified by:
onCacheInitializedin interfaceCacheEvictor
-
onStartFile
public void onStartFile(Cache cache, String key, long position, long length)
Deprecated.Description copied from interface:CacheEvictorCalled when a writer starts writing to the cache.- Specified by:
onStartFilein interfaceCacheEvictor- Parameters:
cache- The source of the event.key- The key being written.position- The starting position of the data being written.length- The length of the data being written, orC.LENGTH_UNSETif unknown.
-
onSpanAdded
public void onSpanAdded(Cache cache, CacheSpan span)
Deprecated.Description copied from interface:Cache.ListenerCalled when aCacheSpanis added to the cache.- Specified by:
onSpanAddedin interfaceCache.Listener- Parameters:
cache- The source of the event.span- The addedCacheSpan.
-
onSpanRemoved
public void onSpanRemoved(Cache cache, CacheSpan span)
Deprecated.Description copied from interface:Cache.ListenerCalled when aCacheSpanis removed from the cache.- Specified by:
onSpanRemovedin interfaceCache.Listener- Parameters:
cache- The source of the event.span- The removedCacheSpan.
-
onSpanTouched
public void onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
Deprecated.Description copied from interface:Cache.ListenerCalled when an existingCacheSpanis touched, causing it to be replaced. The newCacheSpanis guaranteed to represent the same data as the one it replaces, howeverCacheSpan.fileandCacheSpan.lastTouchTimestampmay have changed.Note that for span replacement,
Cache.Listener.onSpanAdded(Cache, CacheSpan)andCache.Listener.onSpanRemoved(Cache, CacheSpan)are not called in addition to this method.- Specified by:
onSpanTouchedin interfaceCache.Listener- Parameters:
cache- The source of the event.oldSpan- The oldCacheSpan, which has been removed from the cache.newSpan- The newCacheSpan, which has been added to the cache.
-
-