Simple implementation of a volatile in-memory key-value store backed by Java's HashMap with support for transactions.
LIMITATIONS
- Single-threaded process
- Only supports 1 data type (Strings)
- No recovery
- Currently only supports commands through a command line interface.
TO USE Compile and run Main. Supported commands are:
- SET KEY VALUE - adds/updates the key with the value and returns the previous value (if the key existed) or null if the key didn't exist yey.
- UNSET KEY - removes the key from the db. Returns the previous value if the key existed or null if the key didn't exist.
- GET KEY - retrieves the current value of the key or null if the key doesn't exist.
- BEGIN - starts a transaction block (can be nested)
- ROLLBACK - undo-s all commands in the current transaction block.
- COMMIT - commits all transaction blocks
- END - exits the session
FUTURE WORK/FEATURES
- Modify structure so that it can be easily imported to use in applications instead of just CLI
- Use concurrent data structures to allow for multi-threaded accesses to the data store.
- Model transactions as threads
- Add / allow more data types (use Generics)
MAYBE?
- Persistence (leaning towards a Redis clone instead of memcached)
- Recovery