private void onDocIdSetEviction(long ramBytesUsed) { this.ramBytesUsed -= ramBytesUsed; LRUQueryCache.this.onDocIdSetEviction(key, 1, ramBytesUsed); }
/** * Remove all cache entries for the given core cache key. */ public void clearCoreCacheKey(Object coreKey) { lock.lock(); try { final LeafCache leafCache = cache.remove(coreKey); if (leafCache != null) { ramBytesUsed -= HASHTABLE_RAM_BYTES_PER_ENTRY; final int numEntries = leafCache.cache.size(); if (numEntries > 0) { onDocIdSetEviction(coreKey, numEntries, leafCache.ramBytesUsed); } else { assert numEntries == 0; assert leafCache.ramBytesUsed == 0; } } } finally { lock.unlock(); } }
@Override protected void onDocIdSetEviction(Object readerCoreKey, int numEntries, long sumRamBytesUsed) { super.onDocIdSetEviction(readerCoreKey, numEntries, sumRamBytesUsed); // onDocIdSetEviction might sometimes be called with a number // of entries equal to zero if the cache for the given segment // was already empty when the close listener was called if (numEntries > 0) { // We can't use ShardCoreKeyMap here because its core closed // listener is called before the listener of the cache which // triggers this eviction. So instead we use use stats2 that // we only evict when nothing is cached anymore on the segment // instead of relying on close listeners final StatsAndCount statsAndCount = stats2.get(readerCoreKey); final Stats shardStats = statsAndCount.stats; shardStats.cacheSize -= numEntries; shardStats.ramBytesUsed -= sumRamBytesUsed; statsAndCount.count -= numEntries; if (statsAndCount.count == 0) { stats2.remove(readerCoreKey); } } }
private void onDocIdSetEviction(long ramBytesUsed) { this.ramBytesUsed -= ramBytesUsed; LRUQueryCache.this.onDocIdSetEviction(key, 1, ramBytesUsed); }
private void onDocIdSetEviction(long ramBytesUsed) { this.ramBytesUsed -= ramBytesUsed; LRUQueryCache.this.onDocIdSetEviction(key, 1, ramBytesUsed); }
private void onDocIdSetEviction(long ramBytesUsed) { this.ramBytesUsed -= ramBytesUsed; LRUQueryCache.this.onDocIdSetEviction(key, 1, ramBytesUsed); }
/** * Remove all cache entries for the given core cache key. */ public synchronized void clearCoreCacheKey(Object coreKey) { final LeafCache leafCache = cache.remove(coreKey); if (leafCache != null) { ramBytesUsed -= HASHTABLE_RAM_BYTES_PER_ENTRY; final int numEntries = leafCache.cache.size(); if (numEntries > 0) { onDocIdSetEviction(coreKey, numEntries, leafCache.ramBytesUsed); } else { assert numEntries == 0; assert leafCache.ramBytesUsed == 0; } } }
/** * Remove all cache entries for the given core cache key. */ public synchronized void clearCoreCacheKey(Object coreKey) { final LeafCache leafCache = cache.remove(coreKey); if (leafCache != null) { ramBytesUsed -= HASHTABLE_RAM_BYTES_PER_ENTRY; final int numEntries = leafCache.cache.size(); if (numEntries > 0) { onDocIdSetEviction(coreKey, numEntries, leafCache.ramBytesUsed); } else { assert numEntries == 0; assert leafCache.ramBytesUsed == 0; } } }
@Override protected void onDocIdSetEviction(Object readerCoreKey, int numEntries, long sumRamBytesUsed) { super.onDocIdSetEviction(readerCoreKey, numEntries, sumRamBytesUsed); // onDocIdSetEviction might sometimes be called with a number // of entries equal to zero if the cache for the given segment // was already empty when the close listener was called if (numEntries > 0) { // We can't use ShardCoreKeyMap here because its core closed // listener is called before the listener of the cache which // triggers this eviction. So instead we use use stats2 that // we only evict when nothing is cached anymore on the segment // instead of relying on close listeners final StatsAndCount statsAndCount = stats2.get(readerCoreKey); final Stats shardStats = statsAndCount.stats; shardStats.cacheSize -= numEntries; shardStats.ramBytesUsed -= sumRamBytesUsed; statsAndCount.count -= numEntries; if (statsAndCount.count == 0) { stats2.remove(readerCoreKey); } } }
@Override protected void onDocIdSetEviction(Object readerCoreKey, int numEntries, long sumRamBytesUsed) { super.onDocIdSetEviction(readerCoreKey, numEntries, sumRamBytesUsed); // onDocIdSetEviction might sometimes be called with a number // of entries equal to zero if the cache for the given segment // was already empty when the close listener was called if (numEntries > 0) { // We can't use ShardCoreKeyMap here because its core closed // listener is called before the listener of the cache which // triggers this eviction. So instead we use use stats2 that // we only evict when nothing is cached anymore on the segment // instead of relying on close listeners final StatsAndCount statsAndCount = stats2.get(readerCoreKey); final Stats shardStats = statsAndCount.stats; shardStats.cacheSize -= numEntries; shardStats.ramBytesUsed -= sumRamBytesUsed; statsAndCount.count -= numEntries; if (statsAndCount.count == 0) { stats2.remove(readerCoreKey); } } }
@Override protected void onDocIdSetEviction(Object readerCoreKey, int numEntries, long sumRamBytesUsed) { super.onDocIdSetEviction(readerCoreKey, numEntries, sumRamBytesUsed); // onDocIdSetEviction might sometimes be called with a number // of entries equal to zero if the cache for the given segment // was already empty when the close listener was called if (numEntries > 0) { // We can't use ShardCoreKeyMap here because its core closed // listener is called before the listener of the cache which // triggers this eviction. So instead we use use stats2 that // we only evict when nothing is cached anymore on the segment // instead of relying on close listeners final StatsAndCount statsAndCount = stats2.get(readerCoreKey); final Stats shardStats = statsAndCount.stats; shardStats.cacheSize -= numEntries; shardStats.ramBytesUsed -= sumRamBytesUsed; statsAndCount.count -= numEntries; if (statsAndCount.count == 0) { stats2.remove(readerCoreKey); } } }
/** * Remove all cache entries for the given core cache key. */ public void clearCoreCacheKey(Object coreKey) { lock.lock(); try { final LeafCache leafCache = cache.remove(coreKey); if (leafCache != null) { ramBytesUsed -= HASHTABLE_RAM_BYTES_PER_ENTRY; final int numEntries = leafCache.cache.size(); if (numEntries > 0) { onDocIdSetEviction(coreKey, numEntries, leafCache.ramBytesUsed); } else { assert numEntries == 0; assert leafCache.ramBytesUsed == 0; } } } finally { lock.unlock(); } }
@Override protected void onDocIdSetEviction(Object readerCoreKey, int numEntries, long sumRamBytesUsed) { assert Thread.holdsLock(this); super.onDocIdSetEviction(readerCoreKey, numEntries, sumRamBytesUsed); // onDocIdSetEviction might sometimes be called with a number // of entries equal to zero if the cache for the given segment // was already empty when the close listener was called if (numEntries > 0) { // We can't use ShardCoreKeyMap here because its core closed // listener is called before the listener of the cache which // triggers this eviction. So instead we use use stats2 that // we only evict when nothing is cached anymore on the segment // instead of relying on close listeners final StatsAndCount statsAndCount = stats2.get(readerCoreKey); final Stats shardStats = statsAndCount.stats; shardStats.cacheSize -= numEntries; shardStats.ramBytesUsed -= sumRamBytesUsed; statsAndCount.count -= numEntries; if (statsAndCount.count == 0) { stats2.remove(readerCoreKey); } } }