org.apache.hadoop.hbase.io.hfile
Class DoubleBlockCache

java.lang.Object
  extended by org.apache.hadoop.hbase.io.hfile.DoubleBlockCache
All Implemented Interfaces:
Iterable<CachedBlock>, HeapSize, BlockCache

Deprecated. As of 1.0, replaced by BucketCache.

@InterfaceAudience.Private
@Deprecated
public class DoubleBlockCache
extends Object
implements BlockCache, HeapSize

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)
          Deprecated. Default constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleBlockCache

public DoubleBlockCache(long onHeapSize,
                        long offHeapSize,
                        long onHeapBlockSize,
                        long offHeapBlockSize,
                        org.apache.hadoop.conf.Configuration conf)
Deprecated. 
Default constructor. Specify maximum size and expected average block size (approximation is fine).

All other factors will be calculated based on defaults specified in this class.

Parameters:
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 cache
conf - configuration file. currently used only by the off heap cache.
Method Detail

cacheBlock

public void cacheBlock(BlockCacheKey cacheKey,
                       Cacheable buf,
                       boolean inMemory)
Deprecated. 
Description copied from interface: BlockCache
Add block to cache.

Specified by:
cacheBlock in interface BlockCache
Parameters:
cacheKey - The block's cache key.
buf - The block contents wrapped in a ByteBuffer.
inMemory - Whether block should be treated as in-memory

cacheBlock

public void cacheBlock(BlockCacheKey cacheKey,
                       Cacheable buf)
Deprecated. 
Description copied from interface: BlockCache
Add block to cache (defaults to not in-memory).

Specified by:
cacheBlock in interface BlockCache
Parameters:
cacheKey - The block's cache key.
buf - The object to cache.

getBlock

public Cacheable getBlock(BlockCacheKey cacheKey,
                          boolean caching,
                          boolean repeat,
                          boolean updateCacheMetrics)
Deprecated. 
Description copied from interface: BlockCache
Fetch block from cache.

Specified by:
getBlock in interface BlockCache
Parameters:
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 not
Returns:
Block or null if block is not in 2 cache.

evictBlock

public boolean evictBlock(BlockCacheKey cacheKey)
Deprecated. 
Description copied from interface: BlockCache
Evict block from cache.

Specified by:
evictBlock in interface BlockCache
Parameters:
cacheKey - Block to evict
Returns:
true if block existed and was evicted, false if not

getStats

public CacheStats getStats()
Deprecated. 
Description copied from interface: BlockCache
Get the statistics for this block cache.

Specified by:
getStats in interface BlockCache
Returns:
Stats

shutdown

public void shutdown()
Deprecated. 
Description copied from interface: BlockCache
Shutdown the cache.

Specified by:
shutdown in interface BlockCache

heapSize

public long heapSize()
Deprecated. 
Specified by:
heapSize in interface HeapSize
Returns:
Approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.

size

public long size()
Deprecated. 
Description copied from interface: BlockCache
Returns the total size of the block cache, in bytes.

Specified by:
size in interface BlockCache
Returns:
size of cache, in bytes

getFreeSize

public long getFreeSize()
Deprecated. 
Description copied from interface: BlockCache
Returns the free size of the block cache, in bytes.

Specified by:
getFreeSize in interface BlockCache
Returns:
free space in cache, in bytes

getCurrentSize

public long getCurrentSize()
Deprecated. 
Description copied from interface: BlockCache
Returns the occupied size of the block cache, in bytes.

Specified by:
getCurrentSize in interface BlockCache
Returns:
occupied space in cache, in bytes

evictBlocksByHfileName

public int evictBlocksByHfileName(String hfileName)
Deprecated. 
Description copied from interface: BlockCache
Evicts all blocks for the given HFile.

Specified by:
evictBlocksByHfileName in interface BlockCache
Returns:
the number of blocks evicted

getBlockCount

public long getBlockCount()
Deprecated. 
Description copied from interface: BlockCache
Returns the number of blocks currently cached in the block cache.

Specified by:
getBlockCount in interface BlockCache
Returns:
number of blocks in the cache

iterator

public Iterator<CachedBlock> iterator()
Deprecated. 
Specified by:
iterator in interface Iterable<CachedBlock>
Specified by:
iterator in interface BlockCache
Returns:
Iterator over the blocks in the cache.

getBlockCaches

public BlockCache[] getBlockCaches()
Deprecated. 
Specified by:
getBlockCaches in interface BlockCache
Returns:
The list of sub blockcaches that make up this one; returns null if no sub caches.


Copyright © 2015 The Apache Software Foundation. All rights reserved.