Manorrock Eagle
This project delivers you with a Key-Value Store abstraction.
Our current list of features/implementations available:
- Azure Cosmos DB implementation
- Azure Blob Storage implementation
- Azure File Share implementation
- Azure KeyVault Certificate implementation
- Azure KeyVault Key implementation
- Azure KeyVault Secret implementation
- ChronicleMap implementation
- Factory functionality
- Filesystem implementation
- Hazelcast implementation
- Oracle Coherence implementation
- Path implementation
- Redis implementation
Our list of things under consideration:
- CDI integration
- JDBC implementation
- Spring Boot starter
Getting started
- Creating the Key-Value Store
- Storing a value.
- Getting a value.
- Removing a value.
Creating the Key-Value Store
Pick one of the Key-Value Store implementations you want to use above.
If you would have taken the Filesystem implementation the code to create the Key-Value Store would look like the code below.
File baseDirectory = new File("mybasedir");
FilesystemKeyValueStore store = new FilesystemKeyValueStore(baseDirectory);
Storing a value
The example below illustrates how to store a value.
store.put("mykey", "myvalue");
Getting a value
The example below illustrates how to store a value.
String value = store.get("mykey");
Deleting a value
The example below illustrates how to delete a value.
store.delete("mykey");
Using your own key type
By default the Key-Value Store is setup to convert a String based key to the underlying data type the Key-Value Store expects. You can deliver your own key mapper that can convert from a data-type of your choice to the underlying data type.
The example below illustrates how to deliver a Long based key mapper.
public class LongToStringMapper implements KeyValueStoreMapper<Long, String> {
public String to(Long from) {
return from.toString();
}
public Long from(String to) {
return Long.valueOf(to);
}
}
store.setKeyMapper(new LongToStringMapper());
Using your own value type
The only difference with the section above is setting the value mapper instead of the key mapper.
The method to set the value mapper is seen below.
store.setValueMapper(new LongtoStringMapper());