Caves
A collection of embedded, thread-safe key-value stores (kvs) in Rust.
Overview
The caves
crate provides a selection of key-value stores with the
following features:
- Embedded
- Thread-safe
- Simple API; get/set/delete a key
- Dev-friendly
You can find more info on the rationale behind this crate on https://docs.rs/caves.
Usage
use Error;
use ;
// Initialize a MemoryCave object.
let b = new;
// Create a new key with an empty value.
b.set;
// Override the key's value.
b.set;
// Retrieve the contents of the key.
let res = b.get;
assert_eq!;
// Delete the key.
b.delete;
// Subsequent attempts to retrieve the contents of the key should return an
// error.
let res = b.get;
assert_eq!;
The above example uses an in-memory backend, but there is also support for
filesystem and RocksDB backends. The latter can be enabled by passing the
with-rocksdb
feature flag for the caves
dependency in your Cargo.toml
.
Documentation
You can read the latest docs in https://docs.rs/caves.
Contributing
You can read the CONTRIBUTING.md
guide for more info on how to contribute to
this project.
Legal
Licensed under MPL-2.0. Please read the NOTICE.md
and LICENSE
files for
the full copyright and license information.