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

## Interface CacheEvictor

- All Superinterfaces:
    `Cache.Listener`
  All Known Implementing Classes:
    `LeastRecentlyUsedCacheEvictor`, `NoOpCacheEvictor`

      public interface CacheEvictor
      extends Cache.Listener

  Evicts data from a `Cache`. Implementations should call `Cache.removeSpan(CacheSpan)` to evict cache entries based on their eviction policies.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `onCacheInitialized()` | Called when cache has been initialized.
    `void` | `onStartFile​(Cache cache, String key, long position, long length)` | Called when a writer starts writing to the cache.
    `boolean` | `requiresCacheSpanTouches()` | Returns whether the evictor requires the `Cache` to touch `CacheSpans` when it accesses them.

    - ### Methods inherited from interface com.google.android.exoplayer2.upstream.cache.Cache.Listener

      `onSpanAdded, onSpanRemoved, onSpanTouched`

- - ### Method Detail

    - #### requiresCacheSpanTouches

          boolean requiresCacheSpanTouches()

      Returns whether the evictor requires the `Cache` to touch `CacheSpans` when it accesses them. Implementations that do not use `CacheSpan.lastTouchTimestamp` should return `false`.

    - #### onCacheInitialized

          void onCacheInitialized()

      Called when cache has been initialized.

    - #### onStartFile

          void onStartFile​(Cache cache,
                           String key,
                           long position,
                           long length)

      Called when a writer starts writing to the cache.
      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, or `C.LENGTH_UNSET` if unknown.