Interface BlockCache
public interface BlockCache
Block cache interface.
- Since:
- 2.0.0
- See Also:
-
org.apache.accumulo.core.spi
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
Cache statistics. -
Method Summary
Modifier and TypeMethodDescriptioncacheBlock
(String blockName, byte[] buf) Add block to cache.Fetch block from cache.getBlock
(String blockName, BlockCache.Loader loader) This method allows a cache to prevent concurrent loads of the same block.long
Get the maximum amount of on heap memory this cache will use.long
Get the maximum size of this cache.getStats()
Get the statistics of this cache.
-
Method Details
-
cacheBlock
Add block to cache.- Parameters:
blockName
- Zero-based file block number.buf
- The block contents wrapped in a ByteBuffer.
-
getBlock
Fetch block from cache.- Parameters:
blockName
- Block name to fetch.- Returns:
- Block or null if block is not in the cache.
-
getBlock
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 fetchloader
- 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
-