Class EntryCacheDisabled

java.lang.Object
org.apache.bookkeeper.mledger.impl.cache.EntryCacheDisabled
All Implemented Interfaces:
Comparable<EntryCache>, EntryCache

public class EntryCacheDisabled extends Object implements EntryCache
Implementation of cache that always read from BookKeeper.
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Specified by:
      getName in interface EntryCache
      Returns:
      the name of the cache
    • insert

      public boolean insert(EntryImpl entry)
      Description copied from interface: EntryCache
      Insert an entry in the cache.

      If the overall limit have been reached, this will trigger the eviction of other entries, possibly from other EntryCache instances

      Specified by:
      insert in interface EntryCache
      Parameters:
      entry - the entry to be cached
      Returns:
      whether the entry was inserted in cache
    • invalidateEntries

      public void invalidateEntries(PositionImpl lastPosition)
      Description copied from interface: EntryCache
      Remove from cache all the entries related to a ledger up to lastPosition excluded.
      Specified by:
      invalidateEntries in interface EntryCache
      Parameters:
      lastPosition - the position of the last entry to be invalidated (non-inclusive)
    • invalidateAllEntries

      public void invalidateAllEntries(long ledgerId)
      Description copied from interface: EntryCache
      Remove from the cache all the entries belonging to a specific ledger.
      Specified by:
      invalidateAllEntries in interface EntryCache
      Parameters:
      ledgerId - the ledger id
    • clear

      public void clear()
      Description copied from interface: EntryCache
      Remove all the entries from the cache.
      Specified by:
      clear in interface EntryCache
    • evictEntries

      public org.apache.commons.lang3.tuple.Pair<Integer,Long> evictEntries(long sizeToFree)
      Description copied from interface: EntryCache
      Force the cache to drop entries to free space.
      Specified by:
      evictEntries in interface EntryCache
      Parameters:
      sizeToFree - the total memory size to free
      Returns:
      a pair containing the number of entries evicted and their total size
    • invalidateEntriesBeforeTimestamp

      public void invalidateEntriesBeforeTimestamp(long timestamp)
      Specified by:
      invalidateEntriesBeforeTimestamp in interface EntryCache
    • asyncReadEntry

      public void asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle lh, long firstEntry, long lastEntry, boolean isSlowestReader, AsyncCallbacks.ReadEntriesCallback callback, Object ctx)
      Description copied from interface: EntryCache
      Read entries from the cache or from bookkeeper.

      Get the entry data either from cache or bookkeeper and mixes up the results in a single list.

      Specified by:
      asyncReadEntry in interface EntryCache
      Parameters:
      lh - the ledger handle
      firstEntry - the first entry to read (inclusive)
      lastEntry - the last entry to read (inclusive)
      isSlowestReader - whether the read entry should be cached
      callback - the callback object that will be notified when read is done
      ctx - the context object
    • asyncReadEntry

      public void asyncReadEntry(org.apache.bookkeeper.client.api.ReadHandle lh, PositionImpl position, AsyncCallbacks.ReadEntryCallback callback, Object ctx)
      Description copied from interface: EntryCache
      Read entry at given position from the cache or from bookkeeper.

      Get the entry data either from cache or bookkeeper and mixes up the results in a single list.

      Specified by:
      asyncReadEntry in interface EntryCache
      Parameters:
      lh - the ledger handle
      position - position to read the entry from
      callback - the callback object that will be notified when read is done
      ctx - the context object
    • getSize

      public long getSize()
      Description copied from interface: EntryCache
      Get the total size in bytes of all the entries stored in this cache.
      Specified by:
      getSize in interface EntryCache
      Returns:
      the size of the entry cache
    • compareTo

      public int compareTo(EntryCache other)
      Specified by:
      compareTo in interface Comparable<EntryCache>