org.apache.hadoop.hbase.io.hfile
Class LruCachedBlock
java.lang.Object
org.apache.hadoop.hbase.io.hfile.LruCachedBlock
- All Implemented Interfaces:
- Comparable<LruCachedBlock>, HeapSize
@InterfaceAudience.Private
public class LruCachedBlock
- extends Object
- implements HeapSize, Comparable<LruCachedBlock>
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.
PER_BLOCK_OVERHEAD
public static final long PER_BLOCK_OVERHEAD
LruCachedBlock
public LruCachedBlock(BlockCacheKey cacheKey,
Cacheable buf,
long accessTime)
LruCachedBlock
public LruCachedBlock(BlockCacheKey cacheKey,
Cacheable buf,
long accessTime,
boolean inMemory)
access
public void access(long accessTime)
- Block has been accessed.
- Parameters:
accessTime
- Last access; this is actually a incremented sequence number rather than an
actual time.
getCachedTime
public long getCachedTime()
- Returns:
- Time we were cached at in nano seconds.
heapSize
public long heapSize()
- Specified by:
heapSize
in interface HeapSize
- Returns:
- Approximate 'exclusive deep size' of implementing object. Includes
count of payload and hosting object sizings.
compareTo
public int compareTo(LruCachedBlock that)
- Specified by:
compareTo
in interface Comparable<LruCachedBlock>
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
getBuffer
public Cacheable getBuffer()
getCacheKey
public BlockCacheKey getCacheKey()
getPriority
public BlockPriority getPriority()
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.