Class ConcurrentIndexCache<T>

java.lang.Object
io.nosqlbench.adapters.api.activityimpl.uniform.ConcurrentIndexCache<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>

public class ConcurrentIndexCache<T> extends Object implements Iterable<T>

This cache implementation packs referents into an atomic array, keeping things as compact as possible, allowing auto-resizing, size tracking, and supporting concurrent access with minimal locking. It also uses a bitset to track the referent indices for enumeration or traversal.

In order to protect against unexpected OOM scenarios, the maximum index is defaulted to 1000000. If you want to have index caches bigger than this, pass ina higher limit.

  • Constructor Details

    • ConcurrentIndexCache

      public ConcurrentIndexCache(String label, LongFunction<T> valueLoader, int maxIndex)
    • ConcurrentIndexCache

      public ConcurrentIndexCache(String label, LongFunction<T> valueLoader)
    • ConcurrentIndexCache

      public ConcurrentIndexCache(String label)
  • Method Details

    • get

      public T get(long key)
    • get

      public T get(long longkey, LongFunction<T> defaultValueLoader)
    • remove

      public T remove(int key)
    • clear

      public void clear()
    • iterator

      @NotNull public @NotNull Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • size

      public int size()