public class BlockCache extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
BlockCache.OnRelease |
Constructor and Description |
---|
BlockCache(Metrics metrics,
boolean directAllocation,
long totalMemory) |
BlockCache(Metrics metrics,
boolean directAllocation,
long totalMemory,
int slabSize) |
BlockCache(Metrics metrics,
boolean directAllocation,
long totalMemory,
int slabSize,
int blockSize) |
Modifier and Type | Method and Description |
---|---|
boolean |
fetch(BlockCacheKey blockCacheKey,
byte[] buffer) |
boolean |
fetch(BlockCacheKey blockCacheKey,
byte[] buffer,
int blockOffset,
int off,
int length) |
int |
getSize()
returns the number of elements in the cache
|
void |
release(BlockCacheKey key) |
boolean |
store(BlockCacheKey blockCacheKey,
int blockOffset,
byte[] data,
int offset,
int length)
This is only best-effort...
|
public static final int _128M
public static final int _32K
public BlockCache(Metrics metrics, boolean directAllocation, long totalMemory)
public BlockCache(Metrics metrics, boolean directAllocation, long totalMemory, int slabSize)
public BlockCache(Metrics metrics, boolean directAllocation, long totalMemory, int slabSize, int blockSize)
public void release(BlockCacheKey key)
public boolean store(BlockCacheKey blockCacheKey, int blockOffset, byte[] data, int offset, int length)
blockCacheKey
- the key for the blockblockOffset
- the offset within the blockdata
- source data to write to the blockoffset
- offset within the source data arraylength
- the number of bytes to write.public boolean fetch(BlockCacheKey blockCacheKey, byte[] buffer, int blockOffset, int off, int length)
blockCacheKey
- the key for the blockbuffer
- the target buffer for the read resultblockOffset
- offset within the blockoff
- offset within the target bufferlength
- the number of bytes to readpublic boolean fetch(BlockCacheKey blockCacheKey, byte[] buffer)
public int getSize()
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.