GH-1071: enable delta-based cache storage by default

This commit is contained in:
Martin Lippert
2024-12-30 14:32:04 +01:00
parent ad1d5d3a7e
commit df5104a81a
5 changed files with 7 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory;
import org.springframework.ide.vscode.boot.common.RelaxedNameConfig;
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
import org.springframework.ide.vscode.boot.index.cache.IndexCache;
import org.springframework.ide.vscode.boot.index.cache.IndexCacheOnDisc;
import org.springframework.ide.vscode.boot.index.cache.IndexCacheOnDiscDeltaBased;
import org.springframework.ide.vscode.boot.index.cache.IndexCacheVoid;
import org.springframework.ide.vscode.boot.java.JavaDefinitionHandler;
import org.springframework.ide.vscode.boot.java.beans.DependsOnDefinitionProvider;
@@ -150,7 +150,7 @@ public class BootLanguageServerBootApp {
@Bean
IndexCache symbolCache(BootLsConfigProperties props) {
if (props.isSymbolCacheEnabled()) {
return new IndexCacheOnDisc(new File(props.getSymbolCacheDir()));
return new IndexCacheOnDiscDeltaBased(new File(props.getSymbolCacheDir()));
} else {
return new IndexCacheVoid();
}

View File

@@ -292,6 +292,8 @@ public class IndexCacheOnDiscDeltaBased implements IndexCache {
private <T extends IndexCacheable> void compact(IndexCacheKey cacheKey, Class<T> type) {
if (this.compactingCounter.get(cacheKey) > this.compactingCounterBoundary) {
log.info("compacting...");
IndexCacheStore<T> compactedData = retrieveStoreFromIncrementalStorage(cacheKey, type).getLeft();
persist(cacheKey, new DeltaSnapshot<T>(compactedData), false);
this.compactingCounter.put(cacheKey, 0);

View File

@@ -60,7 +60,7 @@ public class SpringFactoriesIndexer implements SpringIndexer {
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
private static final String GENERATION = "GEN-6";
private static final String GENERATION = "GEN-7";
private static final String FILE_PATTERN = "**/META-INF/spring/*.factories";

View File

@@ -93,7 +93,7 @@ public class SpringIndexerJava implements SpringIndexer {
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
private static final String GENERATION = "GEN-7";
private static final String GENERATION = "GEN-8";
private static final String INDEX_FILES_TASK_ID = "index-java-source-files-task-";
private static final String SYMBOL_KEY = "symbols";

View File

@@ -54,7 +54,7 @@ public class SpringIndexerXML implements SpringIndexer {
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
private static final String GENERATION = "GEN-5";
private static final String GENERATION = "GEN-6";
private static final String SYMBOL_KEY = "symbols";
private static final String BEANS_KEY = "beans";