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
-
Method Summary
Modifier and TypeMethodDescriptionlong
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:CachingConfig
Get the maximum number of bytes to cache in a single contiguous range of key/value pairs.Default is 10485760L.
- Specified by:
getMaxRangeBytes
in interfaceCachingConfig
- Returns:
- maximum bytes in any one range
-
setMaxRangeBytes
public void setMaxRangeBytes(long maxRangeBytes) Description copied from interface:CachingConfig
Configure the maximum number of bytes to cache in a single contiguous range of key/value pairs.Default is 10485760L.
- Specified by:
setMaxRangeBytes
in interfaceCachingConfig
- Parameters:
maxRangeBytes
- maximum bytes in any one range
-
getMaxTotalBytes
public long getMaxTotalBytes()Description copied from interface:CachingConfig
Get the total number of bytes to cache. This is an overal maximum incluging all ranges.Default is 104857600L.
- Specified by:
getMaxTotalBytes
in interfaceCachingConfig
- Returns:
- maximum cached ranges
-
setMaxTotalBytes
public void setMaxTotalBytes(long maxTotalBytes) Description copied from interface:CachingConfig
Configure the total number of bytes to cache. This is an overal maximum incluging all ranges.Default is 104857600L.
- Specified by:
setMaxTotalBytes
in interfaceCachingConfig
- Parameters:
maxTotalBytes
- maximum cached ranges
-
getMaxRanges
public int getMaxRanges()Description copied from interface:CachingConfig
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.
- Specified by:
getMaxRanges
in interfaceCachingConfig
- Returns:
- maximum cached ranges
-
setMaxRanges
public void setMaxRanges(int maxRanges) Description copied from interface:CachingConfig
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.
- Specified by:
setMaxRanges
in interfaceCachingConfig
- Parameters:
maxRanges
- maximum cached ranges
-
getWaitFactor
public double getWaitFactor()Description copied from interface:CachingConfig
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.
- Specified by:
getWaitFactor
in interfaceCachingConfig
- Returns:
- wait factor
-
setWaitFactor
public void setWaitFactor(double waitFactor) Description copied from interface:CachingConfig
Set the wait factor.Default is 1.5.
- Specified by:
setWaitFactor
in interfaceCachingConfig
- Parameters:
waitFactor
- wait factor
-
isReadAhead
public boolean isReadAhead()Description copied from interface:CachingConfig
Get whether this instance is configured to perform read-ahead.Default is true.
- Specified by:
isReadAhead
in interfaceCachingConfig
- Returns:
- true if read-ahead is enabled, otherwise false
-
setReadAhead
public void setReadAhead(boolean readAhead) Description copied from interface:CachingConfig
Configure whether read-ahead is enabled.Default is true.
- Specified by:
setReadAhead
in interfaceCachingConfig
- Parameters:
readAhead
- true to enable read-ahead, false to disable
-