Package io.permazen.kv.caching
Class AbstractCachingConfig
java.lang.Object
io.permazen.kv.caching.AbstractCachingConfig
- All Implemented Interfaces:
CachingConfig
- Direct Known Subclasses:
CachingKVDatabase,CachingKVTransaction
Support superclass for
CachingConfig implementations.-
Field Summary
Fields inherited from interface io.permazen.kv.caching.CachingConfig
DEFAULT_MAX_RANGE_BYTES, DEFAULT_MAX_RANGES, DEFAULT_MAX_TOTAL_BYTES, DEFAULT_READ_AHEAD, DEFAULT_WAIT_FACTOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGet the maximum number of bytes to cache in a single contiguous range of key/value pairs.intGet the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.longGet the total number of bytes to cache.doubleGet the wait factor.booleanGet whether this instance is configured to perform read-ahead.voidsetMaxRangeBytes(long maxRangeBytes) Configure the maximum number of bytes to cache in a single contiguous range of key/value pairs.voidsetMaxRanges(int maxRanges) Configure the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.voidsetMaxTotalBytes(long maxTotalBytes) Configure the total number of bytes to cache.voidsetReadAhead(boolean readAhead) Configure whether read-ahead is enabled.voidsetWaitFactor(double waitFactor) Set the wait factor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.permazen.kv.caching.CachingConfig
copyCachingConfigTo
-
Constructor Details
-
AbstractCachingConfig
protected AbstractCachingConfig()Constructor.
-
-
Method Details
-
getMaxRangeBytes
public long getMaxRangeBytes()Description copied from interface:CachingConfigGet the maximum number of bytes to cache in a single contiguous range of key/value pairs.Default is 10485760L.
- Specified by:
getMaxRangeBytesin interfaceCachingConfig- Returns:
- maximum bytes in any one range
-
setMaxRangeBytes
public void setMaxRangeBytes(long maxRangeBytes) Description copied from interface:CachingConfigConfigure the maximum number of bytes to cache in a single contiguous range of key/value pairs.Default is 10485760L.
- Specified by:
setMaxRangeBytesin interfaceCachingConfig- Parameters:
maxRangeBytes- maximum bytes in any one range
-
getMaxTotalBytes
public long getMaxTotalBytes()Description copied from interface:CachingConfigGet the total number of bytes to cache. This is an overal maximum incluging all ranges.Default is 104857600L.
- Specified by:
getMaxTotalBytesin interfaceCachingConfig- Returns:
- maximum cached ranges
-
setMaxTotalBytes
public void setMaxTotalBytes(long maxTotalBytes) Description copied from interface:CachingConfigConfigure the total number of bytes to cache. This is an overal maximum incluging all ranges.Default is 104857600L.
- Specified by:
setMaxTotalBytesin interfaceCachingConfig- Parameters:
maxTotalBytes- maximum cached ranges
-
getMaxRanges
public int getMaxRanges()Description copied from interface:CachingConfigGet the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.Default is 256.
- Specified by:
getMaxRangesin interfaceCachingConfig- Returns:
- maximum cached ranges
-
setMaxRanges
public void setMaxRanges(int maxRanges) Description copied from interface:CachingConfigConfigure the maximum number of contiguous ranges of key/value pairs to allow before we start purging the least recently used ones.Default is 256.
- Specified by:
setMaxRangesin interfaceCachingConfig- Parameters:
maxRanges- maximum cached ranges
-
getWaitFactor
public double getWaitFactor()Description copied from interface:CachingConfigGet 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.
- Specified by:
getWaitFactorin interfaceCachingConfig- Returns:
- wait factor
-
setWaitFactor
public void setWaitFactor(double waitFactor) Description copied from interface:CachingConfigSet the wait factor.Default is 1.5.
- Specified by:
setWaitFactorin interfaceCachingConfig- Parameters:
waitFactor- wait factor
-
isReadAhead
public boolean isReadAhead()Description copied from interface:CachingConfigGet whether this instance is configured to perform read-ahead.Default is true.
- Specified by:
isReadAheadin interfaceCachingConfig- Returns:
- true if read-ahead is enabled, otherwise false
-
setReadAhead
public void setReadAhead(boolean readAhead) Description copied from interface:CachingConfigConfigure whether read-ahead is enabled.Default is true.
- Specified by:
setReadAheadin interfaceCachingConfig- Parameters:
readAhead- true to enable read-ahead, false to disable
-