Interface CachingConfig

All Known Implementing Classes:
AbstractCachingConfig, CachingKVDatabase, CachingKVStore, CachingKVTransaction

public interface CachingConfig
API for configuring caching behavior.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Default maximum number of bytes to cache in a single contiguous range of key/value pairs (10485760L).
    static final int
    Default maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones (256).
    static final long
    Default maximum total number of bytes to cache including all ranges (104857600L).
    static final boolean
    Default for whether read-ahead is enabled.
    static final double
    Default wait factor (1.5).
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Copy config parameters.
    long
    Get the maximum number of bytes to cache in a single contiguous range of key/value pairs.
    int
    Get the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.
    long
    Get the total number of bytes to cache.
    double
    Get the wait factor.
    boolean
    Get whether this instance is configured to perform read-ahead.
    void
    setMaxRangeBytes(long maxRangeBytes)
    Configure the maximum number of bytes to cache in a single contiguous range of key/value pairs.
    void
    setMaxRanges(int maxRanges)
    Configure the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.
    void
    setMaxTotalBytes(long maxTotalBytes)
    Configure the total number of bytes to cache.
    void
    setReadAhead(boolean readAhead)
    Configure whether read-ahead is enabled.
    void
    setWaitFactor(double waitFactor)
    Set the wait factor.
  • Field Details

    • DEFAULT_MAX_RANGES

      static final int DEFAULT_MAX_RANGES
      Default maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones (256).
      See Also:
    • DEFAULT_MAX_RANGE_BYTES

      static final long DEFAULT_MAX_RANGE_BYTES
      Default maximum number of bytes to cache in a single contiguous range of key/value pairs (10485760L).
      See Also:
    • DEFAULT_MAX_TOTAL_BYTES

      static final long DEFAULT_MAX_TOTAL_BYTES
      Default maximum total number of bytes to cache including all ranges (104857600L).
      See Also:
    • DEFAULT_WAIT_FACTOR

      static final double DEFAULT_WAIT_FACTOR
      Default wait factor (1.5).
      See Also:
    • DEFAULT_READ_AHEAD

      static final boolean DEFAULT_READ_AHEAD
      Default for whether read-ahead is enabled.
      See Also:
  • Method Details

    • getMaxRangeBytes

      long getMaxRangeBytes()
      Get the maximum number of bytes to cache in a single contiguous range of key/value pairs.

      Default is 10485760L.

      Returns:
      maximum bytes in any one range
    • setMaxRangeBytes

      void setMaxRangeBytes(long maxRangeBytes)
      Configure the maximum number of bytes to cache in a single contiguous range of key/value pairs.

      Default is 10485760L.

      Parameters:
      maxRangeBytes - maximum bytes in any one range
      Throws:
      IllegalArgumentException - if maxRangeBytes <= 0
    • getMaxTotalBytes

      long getMaxTotalBytes()
      Get the total number of bytes to cache. This is an overal maximum incluging all ranges.

      Default is 104857600L.

      Returns:
      maximum cached ranges
    • setMaxTotalBytes

      void setMaxTotalBytes(long maxTotalBytes)
      Configure the total number of bytes to cache. This is an overal maximum incluging all ranges.

      Default is 104857600L.

      Parameters:
      maxTotalBytes - maximum cached ranges
      Throws:
      IllegalArgumentException - if maxTotalBytes <= 0
    • getMaxRanges

      int getMaxRanges()
      Get the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.

      Default is 256.

      Returns:
      maximum cached ranges
    • setMaxRanges

      void setMaxRanges(int maxRanges)
      Configure the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.

      Default is 256.

      Parameters:
      maxRanges - maximum cached ranges
      Throws:
      IllegalArgumentException - if maxRanges <= 0
    • getWaitFactor

      double getWaitFactor()
      Get the wait factor.

      The wait factor, when multiplied by the estimated amount of time we expect to have to wait for incoming data that's already on its way, is how long we will actually wait for that data before initiating a new query. A value of zero means never wait, i.e., always start a new query immediately; a value of 1.0 would mean to wait up to the estimated amount of time; a very high value would mean wait until the outstanding query either produces the data or completes.

      Default is 1.5.

      Returns:
      wait factor
    • setWaitFactor

      void setWaitFactor(double waitFactor)
      Set the wait factor.

      Default is 1.5.

      Parameters:
      waitFactor - wait factor
      Throws:
      IllegalArgumentException - if waitFactor is negative or not finite
    • isReadAhead

      boolean isReadAhead()
      Get whether this instance is configured to perform read-ahead.

      Default is true.

      Returns:
      true if read-ahead is enabled, otherwise false
    • setReadAhead

      void setReadAhead(boolean readAhead)
      Configure whether read-ahead is enabled.

      Default is true.

      Parameters:
      readAhead - true to enable read-ahead, false to disable
    • copyCachingConfigTo

      default void copyCachingConfigTo(CachingConfig dest)
      Copy config parameters.
      Parameters:
      dest - destination for copied caching parameters
      Throws:
      IllegalArgumentException - if dest is null