Interface BlockCache


public interface BlockCache
Block cache interface.
Since:
2.0.0
See Also:
  • org.apache.accumulo.core.spi
  • Method Details

    • cacheBlock

      CacheEntry cacheBlock(String blockName, byte[] buf)
      Add block to cache.
      Parameters:
      blockName - Zero-based file block number.
      buf - The block contents wrapped in a ByteBuffer.
    • getBlock

      CacheEntry getBlock(String blockName)
      Fetch block from cache.
      Parameters:
      blockName - Block name to fetch.
      Returns:
      Block or null if block is not in the cache.
    • getBlock

      CacheEntry getBlock(String blockName, BlockCache.Loader loader)
      This method allows a cache to prevent concurrent loads of the same block. However a cache implementation is not required to prevent concurrent loads. SynchronousLoadingBlockCache is an abstract class that a cache can extent which does prevent concurrent loading of the same block.
      Parameters:
      blockName - Block name to fetch
      loader - If the block is not present in the cache, the loader can be called to load it.
      Returns:
      Block or null if block is not in the cache or didn't load.
    • getMaxHeapSize

      long getMaxHeapSize()
      Get the maximum amount of on heap memory this cache will use.
    • getMaxSize

      long getMaxSize()
      Get the maximum size of this cache.
      Returns:
      max size in bytes
    • getStats

      BlockCache.Stats getStats()
      Get the statistics of this cache.
      Returns:
      statistics