core/src/main/java/org/apache/accumulo/core/file/blockfile/cache/lru/LruBlockCache.java
/**
   * Cache the block with the specified name and buffer.
   * <p>
   * It is assumed this will NEVER be called on an already cached block. If that is done, it is
   * assumed that you are reinserting the same exact block due to a race condition and will update
   * the buffer but not modify the size of the cache.
   *
   * @param blockName
   *          block name
   * @param buf
   *          block buffer
   * @param inMemory
   *          if block is in-memory
   */
Cache the block with the specified name and buffer.

It is assumed this will NEVER be called on an already cached block. If that is done, it is
assumed that you are reinserting the same exact block due to a race condition and will update
the buffer but not modify the size of the cache.

@param blockName
block name
@param buf
block buffer
@param inMemory
if block is in-memory
Cache the block with the specified name and buffer . It is assumed this will NEVER be called on an already cached block . If that is done it is assumed that you are reinserting the same exact block due to a race condition and will update the buffer but not modify the size of the cache . @param blockName block name @param buf block buffer @param inMemory if block is in - memory
public CacheEntry cacheBlock(String blockName, byte buf[], boolean inMemory) {
    CachedBlock cb = map.get(blockName);
    if (cb != null) {
      stats.duplicateReads();
      cb.access(count.incrementAndGet());
    } else {
      cb = new CachedBlock(blockName, buf, count.incrementAndGet(), inMemory);
      CachedBlock currCb = map.putIfAbsent(blockName, cb);
      if (currCb != null) {
        stats.duplicateReads();
        cb = currCb;
        cb.access(count.incrementAndGet());
      } else {
        long newSize = cb.recordSize(size);
        elements.incrementAndGet();
        if (newSize > acceptableSize() && !evictionInProgress) {
          runEviction();
        }
      }
    }
    return wrap(cb);
  }
public CacheEntry cacheBlock ( String blockName , byte buf [ ] , boolean inMemory ) { CachedBlock cb = map . get ( blockName ) ; if ( cb != null ) { stats . duplicateReads ( ) ; cb . access ( count . incrementAndGet ( ) ) ; } else { cb = new CachedBlock ( blockName , buf , count . incrementAndGet ( ) , inMemory ) ; CachedBlock currCb = map . putIfAbsent ( blockName , cb ) ; if ( currCb != null ) { stats . duplicateReads ( ) ; cb = currCb ; cb . access ( count . incrementAndGet ( ) ) ; } else { long newSize = cb . recordSize ( size ) ; elements . incrementAndGet ( ) ; if ( newSize > acceptableSize ( ) && ! evictionInProgress ) { runEviction ( ) ; } } } return wrap ( cb ) ; }
Cache the block with the specified name and buffer.
Cache the block with the specified name and buffer .
// Actually added block to cache