FilterDirectoryReader.DelegatingCacheHelper (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.index, class: FilterDirectoryReader, class: DelegatingCacheHelper

Package org.apache.lucene.index

# Class FilterDirectoryReader.DelegatingCacheHelper

java.lang.Object
org.apache.lucene.index.FilterDirectoryReader.DelegatingCacheHelper

All Implemented Interfaces:
  `IndexReader.CacheHelper`

Enclosing class:
  `FilterDirectoryReader`

protected static class FilterDirectoryReader.DelegatingCacheHelper extends Object implements IndexReader.CacheHelper
A DelegatingCacheHelper is a CacheHelper specialization for implementing long-lived caching behaviour for FilterDirectoryReader subclasses. It uses a unique CacheKey for the purpose of implementing the onClose listener delegation for the reader.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `DelegatingCacheHelper(IndexReader.CacheHelper delegate)`
  Create a new DelegatingCacheHelper that delegates the cache onClose listener to another CacheHelper, but with its own unique CacheKey.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addClosedListener(IndexReader.ClosedListener listener)`
  Add a `IndexReader.ClosedListener` which will be called when the resource guarded by `IndexReader.CacheHelper.getKey()` is closed.
  `IndexReader.CacheKey`
  `getKey()`
  Get a key that the resource can be cached on.

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### DelegatingCacheHelper

    protected DelegatingCacheHelper(IndexReader.CacheHelper delegate)
    Create a new DelegatingCacheHelper that delegates the cache onClose listener to another CacheHelper, but with its own unique CacheKey.
    Parameters:
      `delegate` - the CacheHelper to delegate the close listener to

- ## Method Details

  - ### getKey

    public IndexReader.CacheKey getKey()
    Description copied from interface: `IndexReader.CacheHelper`
    Get a key that the resource can be cached on. The given entry can be compared using identity, ie. `Object.equals(java.lang.Object)` is implemented as `==` and `Object.hashCode()` is implemented as `System.identityHashCode(java.lang.Object)`.
    Specified by:
      `getKey` in interface `IndexReader.CacheHelper`

  - ### addClosedListener

    public void addClosedListener(IndexReader.ClosedListener listener)
    Description copied from interface: `IndexReader.CacheHelper`
    Add a `IndexReader.ClosedListener` which will be called when the resource guarded by `IndexReader.CacheHelper.getKey()` is closed.
    Specified by:
      `addClosedListener` in interface `IndexReader.CacheHelper`