Actix storage is a simple wrapper around some key-value storages to provide basic operations without knowing the backend in advance.
Install
Actix-storage is meant to be used alongside one the implementer crates, ex:
# Cargo.toml
[]
= "0.3.0"
= "0.3.0"
Or you want to use the serde based methods for typed information:
[]
= { = "0.3.0", =["serde-json"]}
Usage
After you picked an implementer:
use ;
use HashMapActor;
use ;
async
And later in your handlers
async
Implementations
actix-storage-hashmap
actix-storage-dashmap
actix-storage-sled
actix-storage-redis
Why?
It can be usefull when:
- You don't know which key-value database you'll need later.
- You can't afford the long time compilation of some dbs while developing.
- hashmap store compiles pretty fast
- You're writing an actix-web extension library and need to support multiple storage backends.
Why not?
If you really care about every drop of your application performance then actix-storage may not be for you, as it uses dynamic dispatching internally.
Examples
There are bunch of examples in the examples folder, very basic ones thought, but it will give you the idea.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.