java-dirty 是一个快速的基于文件的对象存储系统,只能往存储里添加对象,使用内存映射文件技术。
示例代码:
Store<Foo> store = Store.of(Foo.class).from("/path/to/file"); store.put(new Foo(1,2)); store.all().forEach(System.out::println); store.reverse().forEach(System.out::println); store.from(100).forEach(System.out::println); Optional<Foo> foo = store.get(1234); store.observeWrites((object, index) -> System.out.println("Stored "+object+" at "+index); );
Maven:
<dependency> <groupId>uk.co.probablyfine</groupId> <artifactId>java-dirty</artifactId> <version>1.4</version> </dependency