Feature - maxCleanUpDelay and minCleanUpDelay settings added to Config object. #1941

pull/1979/head
Nikita Koksharov 6 years ago
parent a3a952ab07
commit 9ac3a7c553

@ -84,6 +84,9 @@ public class Config {
private boolean useScriptCache = false;
private int minCleanUpDelay = 5;
private int maxCleanUpDelay = 30*60;
/**
* AddressResolverGroupFactory switch between default and round robin
*/
@ -104,6 +107,8 @@ public class Config {
oldConf.setCodec(new FstCodec());
}
setMinCleanUpDelay(oldConf.getMinCleanUpDelay());
setMaxCleanUpDelay(oldConf.getMaxCleanUpDelay());
setDecodeInExecutor(oldConf.isDecodeInExecutor());
setUseScriptCache(oldConf.isUseScriptCache());
setKeepPubSubOrder(oldConf.isKeepPubSubOrder());
@ -739,4 +744,40 @@ public class Config {
return this;
}
public int getMinCleanUpDelay() {
return minCleanUpDelay;
}
/**
* Defines minimal delay of clean up process for expired entries.
* <p>
* Used in JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects
*
* @param minCleanUpDelay - delay in seconds
* @return config
*/
public Config setMinCleanUpDelay(int minCleanUpDelay) {
this.minCleanUpDelay = minCleanUpDelay;
return this;
}
public int getMaxCleanUpDelay() {
return maxCleanUpDelay;
}
/**
* Defines maximal delay of clean up process for expired entries.
* <p>
* Used in JCache, RSetCache, RMapCache, RListMultimapCache, RSetMultimapCache objects
*
* @param maxCleanUpDelay - delay in seconds
* @return config
*/
public Config setMaxCleanUpDelay(int maxCleanUpDelay) {
this.maxCleanUpDelay = maxCleanUpDelay;
return this;
}
}

@ -30,8 +30,8 @@ import org.redisson.command.CommandAsyncExecutor;
abstract class EvictionTask implements Runnable {
final Deque<Integer> sizeHistory = new LinkedList<Integer>();
final int minDelay = 5;
final int maxDelay = 30*60;
final int minDelay;
final int maxDelay;
final int keysLimit = 100;
int delay = 5;
@ -41,6 +41,8 @@ abstract class EvictionTask implements Runnable {
EvictionTask(CommandAsyncExecutor executor) {
super();
this.executor = executor;
this.minDelay = executor.getConnectionManager().getCfg().getMinCleanUpDelay();
this.maxDelay = executor.getConnectionManager().getCfg().getMaxCleanUpDelay();
}
public void schedule() {

Loading…
Cancel
Save