Interface BlockCache

    • Method Detail

      • cacheBlock

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

        CacheEntry getBlock​(String blockName)
        Fetch block from cache.
        blockName - Block name to fetch.
        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.
        blockName - Block name to fetch
        loader - If the block is not present in the cache, the loader can be called to load it.
        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.
        max size in bytes
      • getStats

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