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 void
onCacheInitialized()
Deprecated.Called when cache has been initialized.void
onSpanAdded(Cache cache, CacheSpan span)
Deprecated.Called when aCacheSpan
is added to the cache.void
onSpanRemoved(Cache cache, CacheSpan span)
Deprecated.Called when aCacheSpan
is removed from the cache.void
onSpanTouched(Cache cache, CacheSpan oldSpan, CacheSpan newSpan)
Deprecated.Called when an existingCacheSpan
is touched, causing it to be replaced.void
onStartFile(Cache cache, String key, long position, long length)
Deprecated.Called when a writer starts writing to the cache.boolean
requiresCacheSpanTouches()
Deprecated.Returns whether the evictor requires theCache
to touchCacheSpans
when it accesses them.
-
-
-
Method Detail
-
requiresCacheSpanTouches
public boolean requiresCacheSpanTouches()
Deprecated.Description copied from interface:CacheEvictor
Returns whether the evictor requires theCache
to touchCacheSpans
when it accesses them. Implementations that do not useCacheSpan.lastTouchTimestamp
should returnfalse
.- Specified by:
requiresCacheSpanTouches
in interfaceCacheEvictor
-
onCacheInitialized
public void onCacheInitialized()
Deprecated.Description copied from interface:CacheEvictor
Called when cache has been initialized.- Specified by:
onCacheInitialized
in interfaceCacheEvictor
-
onStartFile
public void onStartFile(Cache cache, String key, long position, long length)
Deprecated.Description copied from interface:CacheEvictor
Called when a writer starts writing to the cache.- Specified by:
onStartFile
in 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_UNSET
if unknown.
-
onSpanAdded
public void onSpanAdded(Cache cache, CacheSpan span)
Deprecated.Description copied from interface:Cache.Listener
Called when aCacheSpan
is added to the cache.- Specified by:
onSpanAdded
in 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.Listener
Called when aCacheSpan
is removed from the cache.- Specified by:
onSpanRemoved
in 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.Listener
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,
Cache.Listener.onSpanAdded(Cache, CacheSpan)
andCache.Listener.onSpanRemoved(Cache, CacheSpan)
are not called in addition to this method.- Specified by:
onSpanTouched
in 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.
-
-