public class HFileBlockCache extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HFileBlockCache.BlockCacheKey
Cache key for identifying blocks uniquely.
|
| Constructor and Description |
|---|
HFileBlockCache(int maxCacheSize,
long expireAfterWrite,
TimeUnit timeUnit) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Forces cache maintenance operations like eviction.
|
void |
clear()
Clears all cached blocks.
|
HFileBlock |
getBlock(HFileBlockCache.BlockCacheKey key)
Gets a block from cache.
|
HFileBlock |
getOrCompute(HFileBlockCache.BlockCacheKey key,
Callable<HFileBlock> loader)
Gets a block from cache, or computes and caches it if not present.
|
void |
putBlock(HFileBlockCache.BlockCacheKey key,
HFileBlock block)
Puts a block into cache.
|
long |
size()
Gets current cache size.
|
public HFileBlockCache(int maxCacheSize,
long expireAfterWrite,
TimeUnit timeUnit)
public HFileBlock getBlock(HFileBlockCache.BlockCacheKey key)
key - the cache keypublic void putBlock(HFileBlockCache.BlockCacheKey key, HFileBlock block)
key - the cache keyblock - the block to cachepublic HFileBlock getOrCompute(HFileBlockCache.BlockCacheKey key, Callable<HFileBlock> loader) throws Exception
key - the cache keyloader - callable to load the block if not in cacheException - if the loader throws an exceptionpublic void clear()
public long size()
public void cleanUp()
Copyright © 2025 The Apache Software Foundation. All rights reserved.