Invalidate cache stats when clearing the cache, closes #1220.

This commit is contained in:
Shay Banon 2011-08-09 15:40:39 +03:00
parent 794a284093
commit 7af84869fc
2 changed files with 7 additions and 0 deletions

View File

@ -135,6 +135,7 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
if (!clearedAtLeastOne) {
service.cache().clear();
}
service.cache().invalidateCache();
}
return new ShardClearIndicesCacheResponse(request.index(), request.shardId());
}

View File

@ -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()) {