public class CachingHFileReaderImpl extends HFileReaderImpl
Uses a shared static cache across all instances to maximize cache hits when multiple readers access the same file.
context, currentDataBlock, currentDataBlockEntry, cursor, dataBlockIndexEntryMap, fileInfo, fileSize, isMetadataInitialized, metaBlockIndexEntryMap, stream, trailerSEEK_TO_BEFORE_BLOCK_FIRST_KEY, SEEK_TO_BEFORE_FILE_FIRST_KEY, SEEK_TO_EOF, SEEK_TO_FOUND, SEEK_TO_IN_RANGE| Constructor and Description |
|---|
CachingHFileReaderImpl(SeekableDataInputStream stream,
long fileSize,
String filePath,
int cacheSize,
int cacheTtlMinutes) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearCache()
Clears the global block cache.
|
void |
close() |
long |
getCacheSize()
Gets current cache size from the global cache.
|
String |
getCacheStats()
Gets cache statistics for monitoring optimization effectiveness.
|
HFileDataBlock |
instantiateHFileDataBlock(BlockIndexEntry blockToRead)
Creates an HFile data block.
|
static void |
resetGlobalCache()
Clears the global cache.
|
getKeyValue, getMetaBlock, getMetaInfo, getNumKeyValueEntries, initializeMetadata, isSeeked, next, seekTo, seekTopublic CachingHFileReaderImpl(SeekableDataInputStream stream, long fileSize, String filePath, int cacheSize, int cacheTtlMinutes)
public HFileDataBlock instantiateHFileDataBlock(BlockIndexEntry blockToRead) throws IOException
HFileReaderImplinstantiateHFileDataBlock in class HFileReaderImplblockToRead - the block index entry to readIOException - if there's an error reading the blockpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class HFileReaderImplIOExceptionpublic long getCacheSize()
public void clearCache()
public String getCacheStats()
public static void resetGlobalCache()
Copyright © 2025 The Apache Software Foundation. All rights reserved.