Package org.apache.hadoop.hbase.io.hfile
Class LruCachedBlock
java.lang.Object
org.apache.hadoop.hbase.io.hfile.LruCachedBlock
- All Implemented Interfaces:
Comparable<LruCachedBlock>
,HeapSize
Represents an entry in the
LruBlockCache
.
Makes the block memory-aware with HeapSize
and Comparable to sort by access time for the
LRU. It also takes care of priority by either instantiating as in-memory or handling the
transition from single to multiple access.
-
Field Summary
Modifier and TypeFieldDescriptionprivate long
private final Cacheable
private final long
Time this block was cached.private final BlockCacheKey
static final long
private BlockPriority
private long
-
Constructor Summary
ConstructorDescriptionLruCachedBlock
(BlockCacheKey cacheKey, Cacheable buf, long accessTime) LruCachedBlock
(BlockCacheKey cacheKey, Cacheable buf, long accessTime, boolean inMemory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
access
(long accessTime) Block has been accessed.int
compareTo
(LruCachedBlock that) boolean
long
Returns Time we were cached at in nano seconds.int
hashCode()
long
heapSize()
Return the approximate 'exclusive deep size' of implementing object.
-
Field Details
-
PER_BLOCK_OVERHEAD
-
cacheKey
-
buf
-
accessTime
-
size
-
priority
-
cachedTime
Time this block was cached. Presumes we are created just before we are added to the cache.
-
-
Constructor Details
-
LruCachedBlock
-
LruCachedBlock
-
-
Method Details
-
access
Block has been accessed.- Parameters:
accessTime
- Last access; this is actually a incremented sequence number rather than an actual time.
-
getCachedTime
Returns Time we were cached at in nano seconds. -
heapSize
Description copied from interface:HeapSize
Return the approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings. -
compareTo
- Specified by:
compareTo
in interfaceComparable<LruCachedBlock>
-
hashCode
-
equals
-
getBuffer
-
getCacheKey
-
getPriority
-