Class ReadCache
- java.lang.Object
-
- org.apache.bookkeeper.bookie.storage.ldb.ReadCache
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class ReadCache extends java.lang.Object implements java.io.CloseableRead cache implementation.Uses the specified amount of memory and pairs it with a hashmap.
The memory is split in multiple segments that are used in a ring-buffer fashion. When the read cache is full, the oldest segment is cleared and rotated to make space for new entries to be added to the read cache.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longcount()io.netty.buffer.ByteBufget(long ledgerId, long entryId)booleanhasEntry(long ledgerId, long entryId)voidput(long ledgerId, long entryId, io.netty.buffer.ByteBuf entry)longsize()
-
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
put
public void put(long ledgerId, long entryId, io.netty.buffer.ByteBuf entry)
-
get
public io.netty.buffer.ByteBuf get(long ledgerId, long entryId)
-
hasEntry
public boolean hasEntry(long ledgerId, long entryId)
-
size
public long size()
- Returns:
- the total size of cached entries
-
count
public long count()
- Returns:
- the total number of cached entries
-
-