introduced cache generation for XML and factories indexer as well
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2022 VMware, Inc.
|
||||
* Copyright (c) 2023 VMware, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -59,6 +59,10 @@ public class SpringFactoriesIndexer implements SpringIndexer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SpringFactoriesIndexer.class);
|
||||
|
||||
// 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-4";
|
||||
|
||||
private static final String FILE_PATTERN = "**/META-INF/spring/*.factories";
|
||||
|
||||
private static final PathMatcher FILE_GLOB_PATTERN = FileSystems.getDefault().getPathMatcher("glob:" + FILE_PATTERN);
|
||||
@@ -155,7 +159,7 @@ public class SpringFactoriesIndexer implements SpringIndexer {
|
||||
}
|
||||
})
|
||||
.collect(Collectors.joining(","));
|
||||
return new IndexCacheKey(project.getElementName(), "factories", "", DigestUtils.md5Hex(filesIndentifier).toUpperCase());
|
||||
return new IndexCacheKey(project.getElementName(), "factories", "", DigestUtils.md5Hex(GENERATION + "-" + filesIndentifier).toUpperCase());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ public class SpringIndexerXML implements SpringIndexer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SpringIndexerJava.class);
|
||||
|
||||
// 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-4";
|
||||
|
||||
private static final String SYMBOL_KEY = "symbols";
|
||||
private static final String BEANS_KEY = "beans";
|
||||
|
||||
@@ -306,7 +310,7 @@ public class SpringIndexerXML implements SpringIndexer {
|
||||
.map(file -> file.getAbsolutePath() + "#" + file.lastModified())
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
return new IndexCacheKey(project.getElementName(), "xml", elementType, DigestUtils.md5Hex(classpathIdentifier).toUpperCase());
|
||||
return new IndexCacheKey(project.getElementName(), "xml", elementType, DigestUtils.md5Hex(GENERATION + "-" + classpathIdentifier).toUpperCase());
|
||||
}
|
||||
|
||||
private void clearIndex() {
|
||||
|
||||
Reference in New Issue
Block a user