com.manorrock.eagle:project

Manorrock Eagle delivers you with a Key-Value Store abstraction.


License
DOC

Documentation

Manorrock Eagle

This project delivers you with a Key-Value Store abstraction.

Our current list of features/implementations available:

  1. Azure Cosmos DB implementation
  2. Azure Blob Storage implementation
  3. Azure File Share implementation
  4. Azure KeyVault Certificate implementation
  5. Azure KeyVault Key implementation
  6. Azure KeyVault Secret implementation
  7. ChronicleMap implementation
  8. Factory functionality
  9. Filesystem implementation
  10. Hazelcast implementation
  11. Oracle Coherence implementation
  12. Path implementation
  13. Redis implementation

Our list of things under consideration:

  1. CDI integration
  2. JDBC implementation
  3. Spring Boot starter

Getting started

  1. Creating the Key-Value Store
  2. Storing a value.
  3. Getting a value.
  4. 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());