public final class TinyLfuBlockCache extends Object implements BlockCache
BlockCache.Loader, BlockCache.Stats
Constructor and Description |
---|
TinyLfuBlockCache(BlockCacheManager.Configuration conf,
CacheType type) |
Modifier and Type | Method and Description |
---|---|
CacheEntry |
cacheBlock(String blockName,
byte[] buffer)
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.
|
public TinyLfuBlockCache(BlockCacheManager.Configuration conf, CacheType type)
public long getMaxHeapSize()
BlockCache
getMaxHeapSize
in interface BlockCache
public long getMaxSize()
BlockCache
getMaxSize
in interface BlockCache
public CacheEntry getBlock(String blockName)
BlockCache
getBlock
in interface BlockCache
blockName
- Block name to fetch.public CacheEntry cacheBlock(String blockName, byte[] buffer)
BlockCache
cacheBlock
in interface BlockCache
blockName
- Zero-based file block number.buffer
- The block contents wrapped in a ByteBuffer.public BlockCache.Stats getStats()
BlockCache
getStats
in interface BlockCache
public CacheEntry getBlock(String blockName, BlockCache.Loader loader)
BlockCache
SynchronousLoadingBlockCache
is an abstract class that a cache can extent which does
prevent concurrent loading of the same block.getBlock
in interface BlockCache
blockName
- Block name to fetchloader
- If the block is not present in the cache, the loader can be called to load it.Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.