public interface BlockCache
Modifier and Type | Interface and Description |
---|---|
static interface |
BlockCache.Loader |
static interface |
BlockCache.Stats
Cache statistics.
|
Modifier and Type | Method and Description |
---|---|
CacheEntry |
cacheBlock(String blockName,
byte[] buf)
Add block to cache.
|
CacheEntry |
getBlock(String blockName)
Fetch block from cache.
|
CacheEntry |
getBlock(String blockName,
BlockCache.Loader loader)
This method allows a cache to prevent concurrent loads of the same block.
|
long |
getMaxHeapSize()
Get the maximum amount of on heap memory this cache will use.
|
long |
getMaxSize()
Get the maximum size of this cache.
|
BlockCache.Stats |
getStats()
Get the statistics of this cache.
|
CacheEntry cacheBlock(String blockName, byte[] buf)
blockName
- Zero-based file block number.buf
- The block contents wrapped in a ByteBuffer.CacheEntry getBlock(String blockName)
blockName
- Block name to fetch.CacheEntry getBlock(String blockName, BlockCache.Loader loader)
SynchronousLoadingBlockCache
is an abstract class that a cache can extent which does
prevent concurrent loading of the same block.blockName
- Block name to fetchloader
- If the block is not present in the cache, the loader can be called to load it.long getMaxHeapSize()
long getMaxSize()
BlockCache.Stats getStats()
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.