Package io.kcache.mapdb
Class MapDBCache<K,V>
- java.lang.Object
-
- io.kcache.utils.PersistentCache<K,V>
-
- io.kcache.mapdb.MapDBCache<K,V>
-
- All Implemented Interfaces:
Cache<K,V>,Closeable,AutoCloseable,Map<K,V>,SortedMap<K,V>,org.apache.kafka.common.Configurable
public class MapDBCache<K,V> extends PersistentCache<K,V>
A persistent key-value store based on MapDB.
-
-
Field Summary
-
Fields inherited from class io.kcache.utils.PersistentCache
DELETEME_FILE_NAME, MOVEME_FILE_NAME
-
-
Constructor Summary
Constructors Constructor Description MapDBCache(String name, String parentDir, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde)MapDBCache(String name, String parentDir, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde, Comparator<K> comparator)MapDBCache(String name, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde)MapDBCache(String name, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde, Comparator<K> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected KeyValueIterator<K,V>all(boolean isDescending)protected voidcloseDB()voidflush()Vget(Object key)protected voidopenDB()Vput(K key, V value)voidputAll(Map<? extends K,? extends V> entries)protected KeyValueIterator<K,V>range(K from, boolean fromInclusive, K to, boolean toInclusive, boolean isDescending)Vremove(Object key)intsize()-
Methods inherited from class io.kcache.utils.PersistentCache
all, clear, close, comparator, containsKey, containsValue, dbDir, descendingCache, destroy, entrySet, firstKey, init, isEmpty, isPersistent, keySerde, keySet, lastKey, name, parentDir, putIfAbsent, range, reset, rootDir, subCache, sync, validateStoreOpen, values, valueSerde
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
MapDBCache
public MapDBCache(String name, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde)
-
MapDBCache
public MapDBCache(String name, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde, Comparator<K> comparator)
-
MapDBCache
public MapDBCache(String name, String parentDir, String rootDir, org.apache.kafka.common.serialization.Serde<K> keySerde, org.apache.kafka.common.serialization.Serde<V> valueSerde)
-
-
Method Detail
-
openDB
protected void openDB()
- Specified by:
openDBin classPersistentCache<K,V>
-
size
public int size()
-
range
protected KeyValueIterator<K,V> range(K from, boolean fromInclusive, K to, boolean toInclusive, boolean isDescending)
- Specified by:
rangein classPersistentCache<K,V>
-
all
protected KeyValueIterator<K,V> all(boolean isDescending)
- Specified by:
allin classPersistentCache<K,V>
-
flush
public void flush()
-
closeDB
protected void closeDB()
- Specified by:
closeDBin classPersistentCache<K,V>
-
-