Class CacheIteratorHelper<K,V>

java.lang.Object
org.elasticsearch.xpack.core.security.support.CacheIteratorHelper<K,V>

public class CacheIteratorHelper<K,V> extends Object
A utility class to facilitate iterating over (and modifying) a Cache. The semantics of the cache are such that when iterating (with the potential to call Iterator.remove()), we must prevent any other modifications. This class provides the necessary methods to support this constraint in a clear manner.
  • Constructor Details

    • CacheIteratorHelper

      public CacheIteratorHelper(Cache<K,V> cache)
  • Method Details

    • acquireUpdateLock

      public ReleasableLock acquireUpdateLock()
    • acquireForIterator

      public ReleasableLock acquireForIterator()
    • removeKeysIf

      public void removeKeysIf(Predicate<K> removeIf)
    • removeValuesIf

      public void removeValuesIf(Predicate<V> removeIf)