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

## Class NoOpCacheEvictor

- java.lang.Object
- - com.google.android.exoplayer2.upstream.cache.NoOpCacheEvictor

- All Implemented Interfaces:
    `Cache.Listener`, `CacheEvictor`

      public final class NoOpCacheEvictor
      extends Object
      implements CacheEvictor

  Evictor that doesn't ever evict cache files.

  Warning: Using this evictor might have unforeseeable consequences if cache size is not managed elsewhere.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `NoOpCacheEvictor()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `onCacheInitialized()` | Called when cache has been initialized.
    `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.
    `void` | `onStartFile​(Cache cache, String key, long position, long maxLength)` | 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 class java.lang.Object

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

- - ### Constructor Detail

    - #### NoOpCacheEvictor

          public NoOpCacheEvictor()

  - ### Method Detail

    - #### requiresCacheSpanTouches

          public boolean requiresCacheSpanTouches()

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

      Description copied from interface: `CacheEvictor`
      Called when cache has been initialized.
      Specified by:
        `onCacheInitialized` in interface `CacheEvictor`

    - #### onStartFile

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

      Description copied from interface: `CacheEvictor`
      Called when a writer starts writing to the cache.
      Specified by:
        `onStartFile` in interface `CacheEvictor`
      Parameters:
        `cache` - The source of the event.
        `key` - The key being written.
        `position` - The starting position of the data being written.
        `maxLength` - The length of the data being written, or `C.LENGTH_UNSET` if unknown.

    - #### onSpanAdded

          public void onSpanAdded​(Cache cache,
                                  CacheSpan span)

      Description copied from interface: `Cache.Listener`
      Called when a `CacheSpan` is added to the cache.
      Specified by:
        `onSpanAdded` in interface `Cache.Listener`
      Parameters:
        `cache` - The source of the event.
        `span` - The added `CacheSpan`.

    - #### onSpanRemoved

          public void onSpanRemoved​(Cache cache,
                                    CacheSpan span)

      Description copied from interface: `Cache.Listener`
      Called when a `CacheSpan` is removed from the cache.
      Specified by:
        `onSpanRemoved` in interface `Cache.Listener`
      Parameters:
        `cache` - The source of the event.
        `span` - The removed `CacheSpan`.

    - #### onSpanTouched

          public void onSpanTouched​(Cache cache,
                                    CacheSpan oldSpan,
                                    CacheSpan newSpan)

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