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…
Reference in New Issue