remove entries from internal memory store when deleting outdated cache files from disc
This commit is contained in:
@@ -217,6 +217,20 @@ public class IndexCacheOnDiscTest {
|
||||
assertFalse(Files.exists(tempDir.resolve(Paths.get(key1.toString() + ".json"))));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDoNotRetrieveOldCacheDataIfNewerVersionIsStored() throws Exception {
|
||||
IndexCacheKey key1 = CACHE_KEY_VERSION_1;
|
||||
IndexCacheKey key2 = new IndexCacheKey("someProject", "someIndexer", "someCategory", "2");
|
||||
|
||||
cache.store(key1, new String[0], new ArrayList<>(), null, CachedSymbol.class);
|
||||
assertNotNull(cache.retrieve(key1, new String[0], CachedSymbol.class));
|
||||
assertNull(cache.retrieve(key2, new String[0], CachedSymbol.class));
|
||||
|
||||
cache.store(key2, new String[0], new ArrayList<>(), null, CachedSymbol.class);
|
||||
assertNull(cache.retrieve(key1, new String[0], CachedSymbol.class));
|
||||
assertNotNull(cache.retrieve(key2, new String[0], CachedSymbol.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDeleteOldCacheFileFromPreviousReleasesIfNewOneIsStored() throws Exception {
|
||||
IndexCacheKey key1 = new IndexCacheKey("someProject", "someIndexer", "", "2");
|
||||
|
||||
Reference in New Issue
Block a user