Interface BlockCache
-
- All Known Implementing Classes:
LruBlockCache
public interface BlockCache
Block cache interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CacheEntry
cacheBlock(String blockName, byte[] buf)
Add block to cache (defaults to not in-memory).CacheEntry
cacheBlock(String blockName, byte[] buf, boolean inMemory)
Add block to cache.CacheEntry
getBlock(String blockName)
Fetch block from cache.CacheEntry
getBlockNoStats(String blockName)
Lock
getLoadLock(String blockName)
Return a lock used for loading data not in the cache.long
getMaxSize()
Get the maximum size of this cache.
-
-
-
Method Detail
-
cacheBlock
CacheEntry cacheBlock(String blockName, byte[] buf, boolean inMemory)
Add block to cache.- Parameters:
blockName
- Zero-based file block number.buf
- The block contents wrapped in a ByteBuffer.inMemory
- Whether block should be treated as in-memory
-
cacheBlock
CacheEntry cacheBlock(String blockName, byte[] buf)
Add block to cache (defaults to not in-memory).- Parameters:
blockName
- Zero-based file block number.buf
- The block contents wrapped in a ByteBuffer.
-
getBlock
CacheEntry getBlock(String blockName)
Fetch block from cache.- Parameters:
blockName
- Block number to fetch.- Returns:
- Block or null if block is not in the cache.
-
getBlockNoStats
CacheEntry getBlockNoStats(String blockName)
-
getMaxSize
long getMaxSize()
Get the maximum size of this cache.- Returns:
- max size in bytes
-
-