Boot property to enable disk-based cache

Also switch the default so disk-based cache is enabled
by default.
This commit is contained in:
Kris De Volder
2019-03-25 14:31:38 -07:00
parent 3d08365fce
commit 436909a344
2 changed files with 14 additions and 5 deletions

View File

@@ -68,11 +68,8 @@ public class BootLanguagServerBootApp {
@ConditionalOnMissingClass("org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness")
@Bean
SymbolCache symbolCache() {
//TODO: Don't use system properties. This should be done via 'proper' spring boot property. That way it can
// be controlled via sysprop or via application.yml, or via env var etc.
//Question... who sets this property? I don't find anything setting this.
if ("true".equals(System.getProperty("boot.ls.symbols.caching.enabled", "true"))) {
SymbolCache symbolCache(BootLsConfigProperties props) {
if (props.isSymbolCacheEnabled()) {
return new SymbolCacheOnDisc();
} else {
return new SymbolCacheVoid();

View File

@@ -31,5 +31,17 @@ public class BootLsConfigProperties {
this.enableJandexIndex = enableJandexIndex;
}
/**
* Enable's or disables disk-based symbol cache. This is
* enabled by default.
*/
private boolean symbolCacheEnabled = true;
public boolean isSymbolCacheEnabled() {
return symbolCacheEnabled;
}
public void setSymbolCacheEnabled(boolean symbolCacheEnabled) {
this.symbolCacheEnabled = symbolCacheEnabled;
}
}