change cache to memory in fs in memory storage of certain files, better name since its not really caching, its actual storage
This commit is contained in:
parent
445db1e559
commit
91d5beca96
|
@ -36,7 +36,7 @@ import org.elasticsearch.util.settings.Settings;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kimchy (Shay Banon)
|
* @author kimchy (shay.banon)
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractFsStore<T extends Directory> extends AbstractStore<T> {
|
public abstract class AbstractFsStore<T extends Directory> extends AbstractStore<T> {
|
||||||
|
|
||||||
|
@ -56,14 +56,14 @@ public abstract class AbstractFsStore<T extends Directory> extends AbstractStore
|
||||||
public abstract FSDirectory fsDirectory();
|
public abstract FSDirectory fsDirectory();
|
||||||
|
|
||||||
protected SwitchDirectory buildSwitchDirectoryIfNeeded(Directory fsDirectory) {
|
protected SwitchDirectory buildSwitchDirectoryIfNeeded(Directory fsDirectory) {
|
||||||
boolean cache = componentSettings.getAsBoolean("cache.enabled", false);
|
boolean cache = componentSettings.getAsBoolean("memory.enabled", false);
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
SizeValue bufferSize = componentSettings.getAsSize("cache.buffer_size", new SizeValue(100, SizeUnit.KB));
|
SizeValue bufferSize = componentSettings.getAsSize("memory.buffer_size", new SizeValue(100, SizeUnit.KB));
|
||||||
SizeValue cacheSize = componentSettings.getAsSize("cache.cache_size", new SizeValue(20, SizeUnit.MB));
|
SizeValue cacheSize = componentSettings.getAsSize("memory.cache_size", new SizeValue(20, SizeUnit.MB));
|
||||||
boolean direct = componentSettings.getAsBoolean("cache.direct", true);
|
boolean direct = componentSettings.getAsBoolean("memory.direct", true);
|
||||||
boolean warmCache = componentSettings.getAsBoolean("cache.warm_cache", true);
|
boolean warmCache = componentSettings.getAsBoolean("memory.warm_cache", true);
|
||||||
|
|
||||||
Directory memDir;
|
Directory memDir;
|
||||||
if (direct) {
|
if (direct) {
|
||||||
|
@ -72,7 +72,7 @@ public abstract class AbstractFsStore<T extends Directory> extends AbstractStore
|
||||||
memDir = new HeapDirectory(bufferSize, cacheSize, warmCache);
|
memDir = new HeapDirectory(bufferSize, cacheSize, warmCache);
|
||||||
}
|
}
|
||||||
// see http://lucene.apache.org/java/3_0_1/fileformats.html
|
// see http://lucene.apache.org/java/3_0_1/fileformats.html
|
||||||
String[] primaryExtensions = componentSettings.getAsArray("cache.extensions", new String[]{"", "del", "gen"});
|
String[] primaryExtensions = componentSettings.getAsArray("memory.extensions", new String[]{"", "del", "gen"});
|
||||||
return new SwitchDirectory(ImmutableSet.of(primaryExtensions), memDir, fsDirectory, true);
|
return new SwitchDirectory(ImmutableSet.of(primaryExtensions), memDir, fsDirectory, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue