@Override public boolean evictBlock(BlockCacheKey cacheKey) { LruCachedBlock cb = map.get(cacheKey); return cb != null && evictBlock(cb, false) > 0; }
@Override public boolean evictBlock(BlockCacheKey cacheKey) { boolean l1Result = this.onHeapCache.evictBlock(cacheKey); boolean l2Result = this.l2Cache.evictBlock(cacheKey); return l1Result || l2Result; } }
@Override public boolean evictBlock(BlockCacheKey cacheKey) { return onHeapCache.evictBlock(cacheKey) || l2Cache.evictBlock(cacheKey); }
public long free(long toFree) { if (LOG.isTraceEnabled()) { LOG.trace("freeing " + StringUtils.byteDesc(toFree) + " from " + this); } LruCachedBlock cb; long freedBytes = 0; while ((cb = queue.pollLast()) != null) { freedBytes += evictBlock(cb, true); if (freedBytes >= toFree) { return freedBytes; } } if (LOG.isTraceEnabled()) { LOG.trace("freed " + StringUtils.byteDesc(freedBytes) + " from " + this); } return freedBytes; }
/** * Evicts all blocks for a specific HFile. This is an * expensive operation implemented as a linear-time search through all blocks * in the cache. Ideally this should be a search in a log-access-time map. * * <p> * This is used for evict-on-close to remove all blocks of a specific HFile. * * @return the number of blocks evicted */ @Override public int evictBlocksByHfileName(String hfileName) { int numEvicted = 0; for (BlockCacheKey key : map.keySet()) { if (key.getHfileName().equals(hfileName)) { if (evictBlock(key)) ++numEvicted; } } if (victimHandler != null) { numEvicted += victimHandler.evictBlocksByHfileName(hfileName); } return numEvicted; }
@Override public boolean evictBlock(BlockCacheKey cacheKey) { CachedBlock cb = map.get(cacheKey); if (cb == null) return false; evictBlock(cb); return true; }
@Override public boolean evictBlock(BlockCacheKey cacheKey) { LruCachedBlock cb = map.get(cacheKey); if (cb == null) return false; evictBlock(cb, false); return true; }
public long free(long toFree) { CachedBlock cb; long freedBytes = 0; while ((cb = queue.pollLast()) != null) { freedBytes += evictBlock(cb); if (freedBytes >= toFree) { return freedBytes; } } return freedBytes; }
@Override public boolean evictBlock(BlockCacheKey cacheKey) { return lruCache.evictBlock(cacheKey) || l2Cache.evictBlock(cacheKey); }
/** * Evicts all blocks for a specific HFile. This is an * expensive operation implemented as a linear-time search through all blocks * in the cache. Ideally this should be a search in a log-access-time map. * * <p> * This is used for evict-on-close to remove all blocks of a specific HFile. * * @return the number of blocks evicted */ @Override public int evictBlocksByHfileName(String hfileName) { int numEvicted = 0; for (BlockCacheKey key : map.keySet()) { if (key.getHfileName().equals(hfileName)) { if (evictBlock(key)) ++numEvicted; } } return numEvicted; }
/** * Evicts all blocks for a specific HFile. This is an * expensive operation implemented as a linear-time search through all blocks * in the cache. Ideally this should be a search in a log-access-time map. * * <p> * This is used for evict-on-close to remove all blocks of a specific HFile. * * @return the number of blocks evicted */ @Override public int evictBlocksByHfileName(String hfileName) { int numEvicted = 0; for (BlockCacheKey key : map.keySet()) { if (key.getHfileName().equals(hfileName)) { if (evictBlock(key)) ++numEvicted; } } if (victimHandler != null) { numEvicted += victimHandler.evictBlocksByHfileName(hfileName); } return numEvicted; }
@Override public boolean evictBlock(BlockCacheKey cacheKey) { stats.evict(); boolean cacheA = onHeapCache.evictBlock(cacheKey); boolean cacheB = offHeapCache.evictBlock(cacheKey); boolean evicted = cacheA || cacheB; if (evicted) { stats.evicted(); } return evicted; }
public long free(long toFree) { if (LOG.isTraceEnabled()) { LOG.trace("freeing " + StringUtils.byteDesc(toFree) + " from " + this); } LruCachedBlock cb; long freedBytes = 0; while ((cb = queue.pollLast()) != null) { freedBytes += evictBlock(cb, true); if (freedBytes >= toFree) { return freedBytes; } } if (LOG.isTraceEnabled()) { LOG.trace("freed " + StringUtils.byteDesc(freedBytes) + " from " + this); } return freedBytes; }