@InterfaceAudience.Private public class LruCachedBlock extends Object implements HeapSize, Comparable<LruCachedBlock>
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.
Modifier and Type | Field and Description |
---|---|
static long |
PER_BLOCK_OVERHEAD |
Constructor and Description |
---|
LruCachedBlock(BlockCacheKey cacheKey,
Cacheable buf,
long accessTime) |
LruCachedBlock(BlockCacheKey cacheKey,
Cacheable buf,
long accessTime,
boolean inMemory) |
Modifier and Type | Method and Description |
---|---|
void |
access(long accessTime)
Block has been accessed.
|
int |
compareTo(LruCachedBlock that) |
boolean |
equals(Object obj) |
Cacheable |
getBuffer() |
long |
getCachedTime() |
BlockCacheKey |
getCacheKey() |
BlockPriority |
getPriority() |
int |
hashCode() |
long |
heapSize() |
public LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime)
public LruCachedBlock(BlockCacheKey cacheKey, Cacheable buf, long accessTime, boolean inMemory)
public void access(long accessTime)
accessTime
- Last access; this is actually a incremented sequence number rather than an
actual time.public long getCachedTime()
public long heapSize()
public int compareTo(LruCachedBlock that)
compareTo
in interface Comparable<LruCachedBlock>
public Cacheable getBuffer()
public BlockCacheKey getCacheKey()
public BlockPriority getPriority()
Copyright © 2007–2019 Cloudera. All rights reserved.