Modifier and Type | Class and Description |
---|---|
static class |
Cache.StatKeys |
Modifier and Type | Field and Description |
---|---|
private int |
cacheDelete |
private int |
cacheFlush |
private int |
hasnotDelete |
private int |
hasnotDouble |
private int |
hasnotHit |
private int |
hasnotMiss |
private int |
hasnotUnique |
private int |
hitLimit |
private Index |
index |
private Row |
keyrow |
private static long |
memStartShrink |
private static long |
memStopGrow |
private int |
missLimit |
private static java.util.TreeMap<java.lang.String,Cache> |
objectTracker |
private int |
readHit |
private RowSet |
readHitCache |
private int |
readMiss |
private RowSet |
readMissCache |
private int |
writeDouble |
private int |
writeUnique |
Constructor and Description |
---|
Cache(Index backupIndex,
int hitLimit,
int missLimit)
create a ObjectIndex cache.
|
Modifier and Type | Method and Description |
---|---|
void |
addUnique(java.util.List<Row.Entry> rows) |
void |
addUnique(Row.Entry row) |
void |
addUnique(Row.Entry row,
java.util.Date entryDate) |
private boolean |
checkHitSpace()
checks for space in the hit cache
|
private boolean |
checkMissSpace()
checks for space in the miss cache
|
void |
clear() |
void |
clearCache() |
void |
close() |
boolean |
delete(byte[] key) |
void |
deleteOnExit() |
java.lang.String |
filename() |
static java.util.Iterator<java.lang.String> |
filenames() |
Row.Entry |
get(byte[] key,
boolean cachecopy) |
java.util.Map<byte[],Row.Entry> |
get(java.util.Collection<byte[]> keys,
boolean forcecopy) |
int |
getHitLimit() |
static long |
getMemStartShrink() |
static long |
getMemStopGrow() |
int |
getMissLimit() |
boolean |
has(byte[] key) |
private void |
init() |
boolean |
isEmpty() |
java.util.Iterator<Row.Entry> |
iterator() |
CloneableIterator<byte[]> |
keys(boolean up,
byte[] firstKey) |
byte[] |
largestKey() |
long |
mem() |
private java.util.Map<Cache.StatKeys,java.lang.String> |
memoryStats() |
static java.util.Map<Cache.StatKeys,java.lang.String> |
memoryStats(java.lang.String filename) |
void |
optimize() |
boolean |
put(Row.Entry row)
Adds the row to the index.
|
java.util.List<Row.Entry> |
random(int count) |
Row.Entry |
remove(byte[] key) |
java.util.List<RowCollection> |
removeDoubles() |
Row.Entry |
removeOne() |
Row.Entry |
replace(Row.Entry row) |
Row |
row() |
CloneableIterator<Row.Entry> |
rows() |
CloneableIterator<Row.Entry> |
rows(boolean up,
byte[] firstKey) |
int |
size() |
byte[] |
smallestKey() |
java.util.List<Row.Entry> |
top(int count) |
int |
writeBufferSize() |
private static final java.util.TreeMap<java.lang.String,Cache> objectTracker
private static final long memStopGrow
private static final long memStartShrink
private final Index index
private RowSet readHitCache
private RowSet readMissCache
private Row keyrow
private int readHit
private int readMiss
private int writeUnique
private int writeDouble
private int cacheDelete
private int cacheFlush
private int hasnotHit
private int hasnotMiss
private int hasnotUnique
private int hasnotDouble
private int hasnotDelete
private final int hitLimit
private final int missLimit
public Cache(Index backupIndex, int hitLimit, int missLimit)
backupIndex
- the ObjectIndex that is cachedhitLimit
- a limit of cache hit entries. If given as value <= 0, then only the RAM limits the sizemissLimit
- a limit of cache miss entries. If given as value <= 0, then only the RAM limits the sizeprivate void init()
public final int writeBufferSize()
public static final long getMemStopGrow()
public static final long getMemStartShrink()
public final int getHitLimit()
public final int getMissLimit()
public byte[] smallestKey()
smallestKey
in interface Index
public byte[] largestKey()
largestKey
in interface Index
public static final java.util.Iterator<java.lang.String> filenames()
public static final java.util.Map<Cache.StatKeys,java.lang.String> memoryStats(java.lang.String filename)
private final java.util.Map<Cache.StatKeys,java.lang.String> memoryStats()
private final boolean checkMissSpace()
private final boolean checkHitSpace()
public final void clearCache()
public final Row.Entry get(byte[] key, boolean cachecopy) throws java.io.IOException
public java.util.Map<byte[],Row.Entry> get(java.util.Collection<byte[]> keys, boolean forcecopy) throws java.io.IOException, java.lang.InterruptedException
public final boolean put(Row.Entry row) throws java.io.IOException, SpaceExceededException
Index
put
in interface Index
row
- a index rowjava.io.IOException
SpaceExceededException
public final Row.Entry replace(Row.Entry row) throws java.io.IOException, SpaceExceededException
replace
in interface Index
java.io.IOException
SpaceExceededException
public final void addUnique(Row.Entry row) throws java.io.IOException, SpaceExceededException
addUnique
in interface Index
java.io.IOException
SpaceExceededException
public final void addUnique(Row.Entry row, java.util.Date entryDate) throws java.io.IOException, SpaceExceededException
java.io.IOException
SpaceExceededException
public final void addUnique(java.util.List<Row.Entry> rows) throws java.io.IOException, SpaceExceededException
java.io.IOException
SpaceExceededException
public final java.util.List<RowCollection> removeDoubles() throws java.io.IOException, SpaceExceededException
removeDoubles
in interface Index
java.io.IOException
SpaceExceededException
public final boolean delete(byte[] key) throws java.io.IOException
public final Row.Entry remove(byte[] key) throws java.io.IOException
public final Row.Entry removeOne() throws java.io.IOException
public java.util.List<Row.Entry> top(int count) throws java.io.IOException
public java.util.List<Row.Entry> random(int count) throws java.io.IOException
public final CloneableIterator<byte[]> keys(boolean up, byte[] firstKey) throws java.io.IOException
public final CloneableIterator<Row.Entry> rows(boolean up, byte[] firstKey) throws java.io.IOException
public final java.util.Iterator<Row.Entry> iterator()
public final CloneableIterator<Row.Entry> rows() throws java.io.IOException
public final void clear() throws java.io.IOException
public final void deleteOnExit()
deleteOnExit
in interface Index