Mnemonix
After a couple years of playing with the concept and learning my way around ever-evolving idiomatic Elixir and venerable OTP patterns, I’ve finally sat down and implemented an Elixir library with an architecture I’m pleased with.
Rubyists might be familiar with Moneta; this is my Elixir approach to that. Mnemonix is a standardized Map-compatible API for interacting with key-value stores in an implementation-agnostic way.
The intent is to define an abstract API a key-value store should offer, and iron out discrepancies between implementations and Elixir wrappers such that they all comply and behave predictably behind it.
If you’re developing an application, it lets you trivially experiment with different backends to find the right implementation for your use-case, and unifies access to different backends chosen for different reasons behind a common, familiar API.
If you’re building a library, it lets you defer the implementation decision of what key-value store to support to your end-users.
Current State
As of v0.7.1, I’m beginning to move towards optimization and better error reporting. The public API has now stabilized and only new capabilities will change public function signatures.
Currently, it offers parity with the Map
module, and builds upon that with extra functions for common key-value store needs: incrementing and decrementing integer values, and setting explicit keys to expire after so many seconds.
It supports several backends:
- Map
- ETS
- DETS
- Mnesia
- Redis
- Memcache
I intend to improve the existing backends, add a few more, and add a few more features to all stores before v1.0.0.
Check out the documentation to learn more, let me know of any issues you run into!