BucketCache
.@InterfaceAudience.Private @Deprecated public class DoubleBlockCache extends Object implements BlockCache, HeapSize
Constructor and Description |
---|
DoubleBlockCache(long onHeapSize,
long offHeapSize,
long onHeapBlockSize,
long offHeapBlockSize,
org.apache.hadoop.conf.Configuration conf)
Deprecated.
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cacheBlock(BlockCacheKey cacheKey,
Cacheable buf)
Deprecated.
Add block to cache (defaults to not in-memory).
|
void |
cacheBlock(BlockCacheKey cacheKey,
Cacheable buf,
boolean inMemory)
Deprecated.
Add block to cache.
|
boolean |
evictBlock(BlockCacheKey cacheKey)
Deprecated.
Evict block from cache.
|
int |
evictBlocksByHfileName(String hfileName)
Deprecated.
Evicts all blocks for the given HFile.
|
Cacheable |
getBlock(BlockCacheKey cacheKey,
boolean caching,
boolean repeat,
boolean updateCacheMetrics)
Deprecated.
Fetch block from cache.
|
BlockCache[] |
getBlockCaches()
Deprecated.
|
long |
getBlockCount()
Deprecated.
Returns the number of blocks currently cached in the block cache.
|
long |
getCurrentSize()
Deprecated.
Returns the occupied size of the block cache, in bytes.
|
long |
getFreeSize()
Deprecated.
Returns the free size of the block cache, in bytes.
|
CacheStats |
getStats()
Deprecated.
Get the statistics for this block cache.
|
long |
heapSize()
Deprecated.
|
Iterator<CachedBlock> |
iterator()
Deprecated.
|
void |
shutdown()
Deprecated.
Shutdown the cache.
|
long |
size()
Deprecated.
Returns the total size of the block cache, in bytes.
|
public DoubleBlockCache(long onHeapSize, long offHeapSize, long onHeapBlockSize, long offHeapBlockSize, org.apache.hadoop.conf.Configuration conf)
All other factors will be calculated based on defaults specified in this class.
onHeapSize
- maximum size of the onHeapCache, in bytes.offHeapSize
- maximum size of the offHeapCache, in bytes.onHeapBlockSize
- average block size of the on heap cache.offHeapBlockSize
- average block size for the off heap cacheconf
- configuration file. currently used only by the off heap cache.public void cacheBlock(BlockCacheKey cacheKey, Cacheable buf, boolean inMemory)
BlockCache
cacheBlock
in interface BlockCache
cacheKey
- The block's cache key.buf
- The block contents wrapped in a ByteBuffer.inMemory
- Whether block should be treated as in-memorypublic void cacheBlock(BlockCacheKey cacheKey, Cacheable buf)
BlockCache
cacheBlock
in interface BlockCache
cacheKey
- The block's cache key.buf
- The object to cache.public Cacheable getBlock(BlockCacheKey cacheKey, boolean caching, boolean repeat, boolean updateCacheMetrics)
BlockCache
getBlock
in interface BlockCache
cacheKey
- Block to fetch.caching
- Whether this request has caching enabled (used for stats)repeat
- Whether this is a repeat lookup for the same block
(used to avoid double counting cache misses when doing double-check locking)updateCacheMetrics
- Whether to update cache metrics or notpublic boolean evictBlock(BlockCacheKey cacheKey)
BlockCache
evictBlock
in interface BlockCache
cacheKey
- Block to evictpublic CacheStats getStats()
BlockCache
getStats
in interface BlockCache
public void shutdown()
BlockCache
shutdown
in interface BlockCache
public long heapSize()
public long size()
BlockCache
size
in interface BlockCache
public long getFreeSize()
BlockCache
getFreeSize
in interface BlockCache
public long getCurrentSize()
BlockCache
getCurrentSize
in interface BlockCache
public int evictBlocksByHfileName(String hfileName)
BlockCache
evictBlocksByHfileName
in interface BlockCache
public long getBlockCount()
BlockCache
getBlockCount
in interface BlockCache
public Iterator<CachedBlock> iterator()
iterator
in interface Iterable<CachedBlock>
iterator
in interface BlockCache
public BlockCache[] getBlockCaches()
getBlockCaches
in interface BlockCache
Copyright © 2014 The Apache Software Foundation. All rights reserved.