add type to filter cache
This commit is contained in:
parent
dc1402597f
commit
0e3ca48aa9
|
@ -24,9 +24,11 @@ import org.elasticsearch.index.IndexComponent;
|
|||
import org.elasticsearch.util.component.CloseableComponent;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public interface FilterCache extends IndexComponent, CloseableComponent {
|
||||
|
||||
String type();
|
||||
|
||||
Filter cache(Filter filterToCache);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ public class NoneFilterCache extends AbstractIndexComponent implements FilterCac
|
|||
logger.debug("Using no filter cache");
|
||||
}
|
||||
|
||||
@Override public String type() {
|
||||
return "none";
|
||||
}
|
||||
|
||||
@Override public void close() {
|
||||
// nothing to do here
|
||||
}
|
||||
|
|
|
@ -40,6 +40,10 @@ public class SoftFilterCache extends AbstractConcurrentMapFilterCache {
|
|||
super(index, indexSettings, threadPool);
|
||||
}
|
||||
|
||||
@Override public String type() {
|
||||
return "soft";
|
||||
}
|
||||
|
||||
@Override protected ConcurrentMap<Filter, DocIdSet> buildMap() {
|
||||
return new MapMaker().softValues().makeMap();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class AbstractConcurrentMapFilterCache extends AbstractIndexComp
|
|||
|
||||
this.readerCleanerSchedule = componentSettings.getAsTime("readerCleanerSchedule", TimeValue.timeValueMinutes(1));
|
||||
|
||||
logger.debug("Using weak filter cache with readerCleanerSchedule [{}]", readerCleanerSchedule);
|
||||
logger.debug("Using [" + type() + "] filter cache with readerCleanerSchedule [{}]", readerCleanerSchedule);
|
||||
|
||||
this.cache = newConcurrentMap();
|
||||
this.scheduleFuture = threadPool.scheduleWithFixedDelay(new IndexReaderCleaner(), readerCleanerSchedule);
|
||||
|
|
|
@ -40,6 +40,10 @@ public class WeakFilterCache extends AbstractConcurrentMapFilterCache {
|
|||
super(index, indexSettings, threadPool);
|
||||
}
|
||||
|
||||
@Override public String type() {
|
||||
return "weak";
|
||||
}
|
||||
|
||||
@Override protected ConcurrentMap<Filter, DocIdSet> buildMap() {
|
||||
return new MapMaker().weakValues().makeMap();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue