Velvetdb is a Java persistent framework perfectly fitting for microservices, small websites, desktop and mobile applications. With zero configuration and simple API you'll need just 5 minutes to start using velvetdb. Velvetdb is Java-centric: you don't have to deal with tables or columns, it's essentially a storage for you Java classes.
Backed by xodus and kryo, velvetdb provides ultra-high performance for read and write operations and stored data in a compact format.
Velvetdb's design is based on these principles making it distinct:
velvetdb is on Maven Central
Select the artifact matching your choice of backend: velvetdb-xodus, velvetdb-mapdb or velvetdb-dynamodb
<dependency>
<groupId>com.github.zakgof</groupId>
<artifactId>velvetdb-xodus</artifactId>
<version>0.11.2</version>
</dependency>
<dependency>
<groupId>com.github.zakgof</groupId>
<artifactId>velvetdb-core</artifactId>
<version>0.11.2</version>
</dependency>
<dependency>
<groupId>com.github.zakgof</groupId>
<artifactId>velvetdb-serializer-kryo</artifactId>
<version>0.11.2</version>
</dependency>
or, using Gradle:
implementation 'com.github.zakgof:velvetdb-xodus:0.10.2'
implementation 'com.github.zakgof:velvetdb-core:0.10.2'
implementation 'com.github.zakgof:velvetdb-serializer-kryo:0.10.2'
IVelvetEnvironment velvetEnv = VelvetFactory.create("xodus", "~/velvetdemo/");
// your class
public class Book {
@Key
private String isbn;
private String title;
private int year;
}
// define an entity
IEntityDef<String, Book> BOOK = Entities.create(Book.class);
// Say you have some POJOs to store
Book book = new Book...
// Store a book
bookEntity.put()
.value(book)
.execute(velvetEnv);
// Get a book by ISBN (primary index lookup)
Book book = bookEntity.get()
.key(isbn)
.execute(velvetEnv);
// Get all the books released in 2000 or later (secondary index query)
List<Book> booksAfter2000 = bookEntity.index("year")
.query()
.gte(2000)
.get()
.asValueList()
.execute(velvetEnv);
// Delete a book by ISBN
bookEntity.delete()
.key(isbn)
.execute(velvetEnv);