From 568dec6b5add2e0778d2f91bc3ef010c105626c4 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 21 Apr 2011 02:05:05 +0300 Subject: [PATCH] Simplify Filter Cache Eviction Settings, closes #871. --- .../index/cache/filter/resident/ResidentFilterCache.java | 6 +++--- .../index/cache/filter/soft/SoftFilterCache.java | 5 +++-- .../index/cache/filter/weak/WeakFilterCache.java | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java index 82c15ed49d2..a5dd46c4f47 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/resident/ResidentFilterCache.java @@ -49,11 +49,11 @@ public class ResidentFilterCache extends AbstractConcurrentMapFilterCache implem @Inject public ResidentFilterCache(Index index, @IndexSettings Settings indexSettings) { super(index, indexSettings); - this.maxSize = componentSettings.getAsInt("max_size", 1000); - this.expire = componentSettings.getAsTime("expire", null); + this.maxSize = indexSettings.getAsInt("index.cache.filter.max_size", componentSettings.getAsInt("max_size", 1000)); + 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 buildFilterMap() { MapMaker mapMaker = new MapMaker(); if (maxSize != -1) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java index 8e4f8dea3a2..69c7a71e5c2 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/soft/SoftFilterCache.java @@ -50,8 +50,9 @@ public class SoftFilterCache extends AbstractConcurrentMapFilterCache implements @Inject public SoftFilterCache(Index index, @IndexSettings Settings indexSettings) { super(index, indexSettings); - this.maxSize = componentSettings.getAsInt("max_size", -1); - this.expire = componentSettings.getAsTime("expire", null); + this.maxSize = indexSettings.getAsInt("index.cache.filter.max_size", componentSettings.getAsInt("max_size", -1)); + 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 buildCache() { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/weak/WeakFilterCache.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/weak/WeakFilterCache.java index 62dd7006390..5f6253b37bf 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/weak/WeakFilterCache.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/cache/filter/weak/WeakFilterCache.java @@ -50,8 +50,9 @@ public class WeakFilterCache extends AbstractConcurrentMapFilterCache implements @Inject public WeakFilterCache(Index index, @IndexSettings Settings indexSettings) { super(index, indexSettings); - this.maxSize = componentSettings.getAsInt("max_size", -1); - this.expire = componentSettings.getAsTime("expire", null); + this.maxSize = indexSettings.getAsInt("index.cache.filter.max_size", componentSettings.getAsInt("max_size", -1)); + 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 buildCache() {