Hello,
I have the following setup in a unit test:
final Serializer valueSerializer = new ValueSerializer(); //CUSTOM serializer
HTreeMap<String, Properties> diskStore = DBMaker.tempFileDB().make().hashMap("disk", Serializer.STRING, valueSerializer).createOrOpen();
HTreeMap<String, Properties> heapStore = DBMaker.heapDB().make().hashMap("heap", Serializer.STRING, valueSerializer)
.expireOverflow(diskStore)
.expireStoreSize(100)
.expireAfterCreate()
.createOrOpen();
// populate store
for (int i=0; i<100; i++) {
Properties prop = new Properties();
prop.setProperty("index", i + "");
heapStore.put("props" + i , prop);
}
diskStore.close();
heapStore.close();
What I want here is to be able to store only 100B on heap and the rest of the records to overflow to disk. However, while running this code I get the following exception:
java.lang.ClassCastException: org.mapdb.StoreOnHeap cannot be cast to org.mapdb.StoreDirect
at org.mapdb.HTreeMap$expireEvictSegment$1.take(HTreeMap.kt:875)
at org.mapdb.QueueLong.takeUntil(QueueLong.kt:153)
at org.mapdb.HTreeMap.expireEvictSegment(HTreeMap.kt:859)
at org.mapdb.HTreeMap.put(HTreeMap.kt:322)
Could you please take a look?
Thanks!