Back to Exoplayer

LeastRecentlyUsedCacheEvictor (ExoPlayer library)

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

latest7.6 KB
Original Source

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

Class LeastRecentlyUsedCacheEvictor

  • java.lang.Object

    • com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor
  • All Implemented Interfaces:Cache.Listener, CacheEvictor


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classLeastRecentlyUsedCacheEvictorextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[CacheEvictor](CacheEvictor.html "interface in com.google.android.exoplayer2.upstream.cache")

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 a CacheSpan is added to the cache. | | void | onSpanRemoved​(Cache cache, CacheSpan span) | Deprecated.

Called when a CacheSpan is removed from the cache. | | void | onSpanTouched​(Cache cache, CacheSpan oldSpan, CacheSpan newSpan) | Deprecated.

Called when an existing CacheSpan 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 the Cache to touch CacheSpans when it accesses them. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

- 

LeastRecentlyUsedCacheEvictor

public LeastRecentlyUsedCacheEvictor​(long maxBytes)

Deprecated.

Method Detail

- 

requiresCacheSpanTouches

public boolean requiresCacheSpanTouches()

Deprecated.

Description copied from interface: CacheEvictor

Returns whether the evictor requires the Cache to touch CacheSpans when it accesses them. Implementations that do not use CacheSpan.lastTouchTimestamp should return false. Specified by:requiresCacheSpanTouches in interface CacheEvictor

- 

onCacheInitialized

public void onCacheInitialized()

Deprecated.

Description copied from interface: CacheEvictor

Called when cache has been initialized. Specified by:onCacheInitialized in interface CacheEvictor

- 

onStartFile

public void onStartFile​([Cache](Cache.html "interface in com.google.android.exoplayer2.upstream.cache")cache,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")key,
                        long position,
                        long length)

Deprecated.

Description copied from interface: CacheEvictor

Called when a writer starts writing to the cache. Specified by:onStartFile in interface CacheEvictorParameters: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, or C.LENGTH_UNSET if unknown.

- 

onSpanAdded

public 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)

Deprecated.

Description copied from interface: Cache.Listener

Called when a CacheSpan is added to the cache. Specified by:onSpanAdded in interface Cache.ListenerParameters:cache - The source of the event.span - The added CacheSpan.

- 

onSpanRemoved

public 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)

Deprecated.

Description copied from interface: Cache.Listener

Called when a CacheSpan is removed from the cache. Specified by:onSpanRemoved in interface Cache.ListenerParameters:cache - The source of the event.span - The removed CacheSpan.

- 

onSpanTouched

public 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)

Deprecated.

Description copied from interface: Cache.Listener

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, Cache.Listener.onSpanAdded(Cache, CacheSpan) and Cache.Listener.onSpanRemoved(Cache, CacheSpan) are not called in addition to this method.

Specified by:onSpanTouched in interface Cache.ListenerParameters: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.