protected long evictBlock(LruCachedBlock block, boolean evictedByEvictionProcess) {
    final MutableBoolean evicted = new MutableBoolean(false);
    // Note: 'map' must be a ConcurrentHashMap or the supplier may be invoked more than once.
    map.computeIfPresent(block.getCacheKey(), (k, v) -> {
      // Run the victim handler before we remove the mapping in the L1 map. It must complete
      // quickly because other removal or insertion operations can be blocked in the meantime.
      if (evictedByEvictionProcess && victimHandler != null) {
        victimHandler.cacheBlock(k, v.getBuffer());
      }
      // Decrease the block's reference count, and if refCount is 0, then it'll auto-deallocate. DO
      // NOT move this up because if we do that then the victimHandler may access the buffer with
      // refCnt = 0 which is disallowed.
      v.getBuffer().release();
      evicted.setTrue();
      // By returning null from the supplier we remove the mapping from the L1 map.
      return null;
    });
    // If we didn't find anything to evict there is nothing more to do here.
    if (evicted.isFalse()) {
      return 0;
    }
    // We evicted the block so update L1 statistics.
    updateSizeMetrics(block, true);
    long val = elements.decrementAndGet();
    if (LOG.isTraceEnabled()) {
      long size = map.size();
      assertCounterSanity(size, val);
    }
    BlockType bt = block.getBuffer().getBlockType();
    if (bt.isBloom()) {
      bloomBlockElements.decrement();
    } else if (bt.isIndex()) {
      indexBlockElements.decrement();
    } else if (bt.isData()) {
      dataBlockElements.decrement();
    }
    if (evictedByEvictionProcess) {
      // When the eviction of the block happened because of invalidation of HFiles, no need to
      // update the stats counter.
      stats.evicted(block.getCachedTime(), block.getCacheKey().isPrimary());
    }
    return block.heapSize();
  }
Evict the block, and it will be cached by the victim handler if exists &amp;&amp; block may be
read again later
@param evictedByEvictionProcess true if the given block is evicted by EvictionThread
@return the heap size of evicted block
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java