org.apache.accumulo.core.file.blockfile.cache
Class SimpleBlockCache

java.lang.Object
  extended by org.apache.accumulo.core.file.blockfile.cache.SimpleBlockCache
All Implemented Interfaces:
BlockCache

public class SimpleBlockCache
extends Object
implements BlockCache

Simple one RFile soft reference cache.


Field Summary
 int dumps
           
 
Constructor Summary
SimpleBlockCache()
          Constructor
 
Method Summary
 void cacheBlock(String blockName, byte[] buf)
          Add block to cache (defaults to not in-memory).
 void cacheBlock(String blockName, byte[] buf, boolean inMemory)
          Add block to cache.
 byte[] getBlock(String blockName)
          Fetch block from cache.
 void shutdown()
          Shutdown the cache.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dumps

public int dumps
Constructor Detail

SimpleBlockCache

public SimpleBlockCache()
Constructor

Method Detail

size

public int size()
Returns:
the size

getBlock

public byte[] getBlock(String blockName)
Description copied from interface: BlockCache
Fetch block from cache.

Specified by:
getBlock in interface BlockCache
Parameters:
blockName - Block number to fetch.
Returns:
Block or null if block is not in the cache.

cacheBlock

public void cacheBlock(String blockName,
                       byte[] buf)
Description copied from interface: BlockCache
Add block to cache (defaults to not in-memory).

Specified by:
cacheBlock in interface BlockCache
Parameters:
blockName - Zero-based file block number.
buf - The block contents wrapped in a ByteBuffer.

cacheBlock

public void cacheBlock(String blockName,
                       byte[] buf,
                       boolean inMemory)
Description copied from interface: BlockCache
Add block to cache.

Specified by:
cacheBlock in interface BlockCache
Parameters:
blockName - Zero-based file block number.
buf - The block contents wrapped in a ByteBuffer.
inMemory - Whether block should be treated as in-memory

shutdown

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

Specified by:
shutdown in interface BlockCache


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.