|
|
@ -15,6 +15,7 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
package org.redisson.spring.cache;
|
|
|
|
package org.redisson.spring.cache;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.redisson.api.EvictionMode;
|
|
|
|
import org.redisson.api.map.event.MapEntryListener;
|
|
|
|
import org.redisson.api.map.event.MapEntryListener;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
@ -39,7 +40,9 @@ public class CacheConfig {
|
|
|
|
private long maxIdleTime;
|
|
|
|
private long maxIdleTime;
|
|
|
|
|
|
|
|
|
|
|
|
private int maxSize;
|
|
|
|
private int maxSize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private EvictionMode evictionMode = EvictionMode.LRU;
|
|
|
|
|
|
|
|
|
|
|
|
private final List<MapEntryListener> listeners = new ArrayList<>();
|
|
|
|
private final List<MapEntryListener> listeners = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -79,7 +82,6 @@ public class CacheConfig {
|
|
|
|
public void setTTL(long ttl) {
|
|
|
|
public void setTTL(long ttl) {
|
|
|
|
this.ttl = ttl;
|
|
|
|
this.ttl = ttl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getMaxSize() {
|
|
|
|
public int getMaxSize() {
|
|
|
|
return maxSize;
|
|
|
|
return maxSize;
|
|
|
@ -95,6 +97,21 @@ public class CacheConfig {
|
|
|
|
this.maxSize = maxSize;
|
|
|
|
this.maxSize = maxSize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EvictionMode getEvictionMode() {
|
|
|
|
|
|
|
|
return evictionMode;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Set the eviction mode of the map. Superfluous elements are evicted using LRU or LFU algorithm.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param evictionMode - eviction mode (LRU, LFU)
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public CacheConfig setEvictionMode(EvictionMode evictionMode) {
|
|
|
|
|
|
|
|
this.evictionMode = evictionMode;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getMaxIdleTime() {
|
|
|
|
public long getMaxIdleTime() {
|
|
|
|
return maxIdleTime;
|
|
|
|
return maxIdleTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|