|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.io.hfile.DoubleBlockCache
public class DoubleBlockCache
DoubleBlockCache is an abstraction layer that combines two caches, the smaller onHeapCache and the larger offHeapCache. CacheBlock attempts to cache the block in both caches, while readblock reads first from the faster on heap cache before looking for the block in the off heap cache. Metrics are the combined size and hits and misses of both caches.
| Constructor Summary | |
|---|---|
DoubleBlockCache(long onHeapSize,
long offHeapSize,
long onHeapBlockSize,
long offHeapBlockSize,
org.apache.hadoop.conf.Configuration conf)
Default constructor. |
|
| Method Summary | |
|---|---|
void |
cacheBlock(String blockName,
Cacheable buf)
Add block to cache (defaults to not in-memory). |
void |
cacheBlock(String blockName,
Cacheable buf,
boolean inMemory)
Add block to cache. |
boolean |
evictBlock(String blockName)
Evict block from cache. |
int |
evictBlocksByPrefix(String prefix)
Evicts all blocks with name starting with the given prefix. |
Cacheable |
getBlock(String blockName,
boolean caching)
Fetch block from cache. |
List<BlockCacheColumnFamilySummary> |
getBlockCacheColumnFamilySummaries(org.apache.hadoop.conf.Configuration conf)
Performs a BlockCache summary and returns a List of BlockCacheColumnFamilySummary objects. |
long |
getBlockCount()
Returns the number of blocks currently cached in the block cache. |
long |
getCurrentSize()
Returns the occupied size of the block cache, in bytes. |
long |
getEvictedCount()
Returns the number of evictions that have occurred. |
long |
getFreeSize()
Returns the free size of the block cache, in bytes. |
CacheStats |
getStats()
Get the statistics for this block cache. |
long |
heapSize()
|
void |
shutdown()
Shutdown the cache. |
long |
size()
Returns the total size of the block cache, in bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public void cacheBlock(String blockName,
Cacheable buf,
boolean inMemory)
BlockCache
cacheBlock in interface BlockCacheblockName - Zero-based file block number.buf - The block contents wrapped in a ByteBuffer.inMemory - Whether block should be treated as in-memory
public void cacheBlock(String blockName,
Cacheable buf)
BlockCache
cacheBlock in interface BlockCacheblockName - Zero-based file block number.buf - The object to cache.
public Cacheable getBlock(String blockName,
boolean caching)
BlockCache
getBlock in interface BlockCacheblockName - Block number to fetch.caching - Whether this request has caching enabled (used for stats)
public boolean evictBlock(String blockName)
BlockCache
evictBlock in interface BlockCacheblockName - Block name to evict
public CacheStats getStats()
BlockCache
getStats in interface BlockCachepublic void shutdown()
BlockCache
shutdown in interface BlockCachepublic long heapSize()
heapSize in interface HeapSizepublic long size()
BlockCache
size in interface BlockCachepublic long getFreeSize()
BlockCache
getFreeSize in interface BlockCachepublic long getCurrentSize()
BlockCache
getCurrentSize in interface BlockCachepublic long getEvictedCount()
BlockCache
getEvictedCount in interface BlockCachepublic int evictBlocksByPrefix(String prefix)
BlockCache
evictBlocksByPrefix in interface BlockCache
public List<BlockCacheColumnFamilySummary> getBlockCacheColumnFamilySummaries(org.apache.hadoop.conf.Configuration conf)
throws IOException
BlockCache
getBlockCacheColumnFamilySummaries in interface BlockCacheconf - HBaseConfiguration
IOException - exceptionpublic long getBlockCount()
BlockCache
getBlockCount in interface BlockCache
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||