Skip to content

Commit

Permalink
GH-1071: enable delta-based cache storage by default
Browse files Browse the repository at this point in the history
  • Loading branch information
martinlippert committed Dec 30, 2024
1 parent ad1d5d3 commit df5104a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
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;
Expand Down Expand Up @@ -150,7 +150,7 @@ public static void main(String[] args) throws Exception {
@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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ private boolean isFileMatch(SortedMap<String, Long> files1, SortedMap<String, Lo

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static enum SCAN_PASS {

// 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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit df5104a

Please sign in to comment.