api-camp-data-library
Getting Started
import io.github.de314.ac.data.api.kv.KeyValueStore;
import io.github.de314.ac.data.api.service.DataStoreService;
import io.github.de314.ac.data.disk.RockDBDataStoreService;
//import io.github.de314.ac.data.memory.MemoryMapDataStoreService;
import io.github.de314.ac.data.model.Article;
public class Demo {
// private static final DataStoreService STORE_SERVICE = MemoryMapDataStoreService.getInstance();
private static final DataStoreService STORE_SERVICE = RockDBDataStoreService.getInstance();
public static void main(String[] args) {
KeyValueStore<Article> store = STORE_SERVICE.getOrCreate(NAMESPACE_ART_2, Article.class);
assertNotNull(store);
Article a = Article.builder().id(1).build();
assert(0L == store.count());
store.put(a.getKey(), a);
assert(1L == store.count());
Article b = store.get(a.getKey());
asset(a.equals(b));
}