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
FieldsModifier and TypeFieldDescriptionprivate longprivate final Cacheableprivate final longTime this block was cached.private final BlockCacheKeystatic final longprivate BlockPriorityprivate long -
Constructor Summary
ConstructorsConstructorDescriptionLruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime) LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime, boolean inMemory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccess(long accessTime) Block has been accessed.intcompareTo(LruCachedBlock that) booleanlongReturns Time we were cached at in nano seconds.inthashCode()longheapSize()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:HeapSizeReturn the approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings. -
compareTo
- Specified by:
compareToin interfaceComparable<LruCachedBlock>
-
hashCode
-
equals
-
getBuffer
-
getCacheKey
-
getPriority
-