mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Invalidate cache stats when clearing the cache, closes #1220.
This commit is contained in:
parent
794a284093
commit
7af84869fc
@ -135,6 +135,7 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
|
||||
if (!clearedAtLeastOne) {
|
||||
service.cache().clear();
|
||||
}
|
||||
service.cache().invalidateCache();
|
||||
}
|
||||
return new ShardClearIndicesCacheResponse(request.index(), request.shardId());
|
||||
}
|
||||
|
@ -82,6 +82,12 @@ public class IndexCache extends AbstractIndexComponent implements CloseableCompo
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void invalidateCache() {
|
||||
FilterCache.EntriesStats filterEntriesStats = filterCache.entriesStats();
|
||||
latestCacheStats = new CacheStats(fieldDataCache.evictions(), filterCache.evictions(), fieldDataCache.sizeInBytes(), filterEntriesStats.sizeInBytes, filterEntriesStats.count, bloomCache.sizeInBytes());
|
||||
latestCacheStatsTimestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized CacheStats stats() {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
if ((timestamp - latestCacheStatsTimestamp) > refreshInterval.millis()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user