Class CachedBlock

  • All Implemented Interfaces:
    Comparable<CachedBlock>, HeapSize

    public class CachedBlock
    extends Object
    implements HeapSize, Comparable<CachedBlock>
    Represents an entry in the configurable block cache.

    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 Detail


        public static final long PER_BLOCK_OVERHEAD
    • Constructor Detail

      • CachedBlock

        public CachedBlock​(String blockName,
                           byte[] buf,
                           long accessTime,
                           boolean inMemory)
    • Method Detail

      • access

        public void access​(long accessTime)
        Block has been accessed. Update its local access time.
      • heapSize

        public long heapSize()
        Specified by:
        heapSize in interface HeapSize
        Approximate 'exclusive deep size' of implementing object. Includes count of payload and hosting object sizings.
      • hashCode

        public int hashCode()
        hashCode in class Object
      • getName

        public String getName()
      • getBuffer

        public byte[] getBuffer()
      • recordSize

        public long recordSize​(AtomicLong totalSize)
      • evicted

        public long evicted​(AtomicLong totalSize)