Simplify Filter Cache Eviction Settings, closes #871.

This commit is contained in:
kimchy 2011-04-21 02:05:05 +03:00
parent 90b88fe4b7
commit 568dec6b5a
3 changed files with 9 additions and 7 deletions

View File

@ -49,11 +49,11 @@ public class ResidentFilterCache extends AbstractConcurrentMapFilterCache implem
@Inject public ResidentFilterCache(Index index, @IndexSettings Settings indexSettings) { @Inject public ResidentFilterCache(Index index, @IndexSettings Settings indexSettings) {
super(index, indexSettings); super(index, indexSettings);
this.maxSize = componentSettings.getAsInt("max_size", 1000); this.maxSize = indexSettings.getAsInt("index.cache.filter.max_size", componentSettings.getAsInt("max_size", 1000));
this.expire = componentSettings.getAsTime("expire", null); this.expire = indexSettings.getAsTime("index.cache.filter.expire", componentSettings.getAsTime("expire", null));
logger.debug("using [resident] filter cache with max_size [{}], expire [{}]", maxSize, expire);
} }
@Override protected ConcurrentMap<Filter, DocSet> buildFilterMap() { @Override protected ConcurrentMap<Filter, DocSet> buildFilterMap() {
MapMaker mapMaker = new MapMaker(); MapMaker mapMaker = new MapMaker();
if (maxSize != -1) { if (maxSize != -1) {

View File

@ -50,8 +50,9 @@ public class SoftFilterCache extends AbstractConcurrentMapFilterCache implements
@Inject public SoftFilterCache(Index index, @IndexSettings Settings indexSettings) { @Inject public SoftFilterCache(Index index, @IndexSettings Settings indexSettings) {
super(index, indexSettings); super(index, indexSettings);
this.maxSize = componentSettings.getAsInt("max_size", -1); this.maxSize = indexSettings.getAsInt("index.cache.filter.max_size", componentSettings.getAsInt("max_size", -1));
this.expire = componentSettings.getAsTime("expire", null); this.expire = indexSettings.getAsTime("index.cache.filter.expire", componentSettings.getAsTime("expire", null));
logger.debug("using [soft] filter cache with max_size [{}], expire [{}]", maxSize, expire);
} }
@Override protected ConcurrentMap<Object, ReaderValue> buildCache() { @Override protected ConcurrentMap<Object, ReaderValue> buildCache() {

View File

@ -50,8 +50,9 @@ public class WeakFilterCache extends AbstractConcurrentMapFilterCache implements
@Inject public WeakFilterCache(Index index, @IndexSettings Settings indexSettings) { @Inject public WeakFilterCache(Index index, @IndexSettings Settings indexSettings) {
super(index, indexSettings); super(index, indexSettings);
this.maxSize = componentSettings.getAsInt("max_size", -1); this.maxSize = indexSettings.getAsInt("index.cache.filter.max_size", componentSettings.getAsInt("max_size", -1));
this.expire = componentSettings.getAsTime("expire", null); this.expire = indexSettings.getAsTime("index.cache.filter.expire", componentSettings.getAsTime("expire", null));
logger.debug("using [weak] filter cache with max_size [{}], expire [{}]", maxSize, expire);
} }
@Override protected ConcurrentMap<Object, ReaderValue> buildCache() { @Override protected ConcurrentMap<Object, ReaderValue> buildCache() {