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.Closeable
Read 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 void
close()
long
count()
io.netty.buffer.ByteBuf
get(long ledgerId, long entryId)
boolean
hasEntry(long ledgerId, long entryId)
void
put(long ledgerId, long entryId, io.netty.buffer.ByteBuf entry)
long
size()
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in 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
-
-