Features
-
Async/await
-
Easy custom Store
-
Stores the values in a
Map<String, Value>
based on serde_json
Examples
let store = new;
let id = format!; // Generates an UID
let store = store.clone;
let session = store.get.await.unwrap; // Fresh Session
session.id.unwrap; // ""
session.status.unwrap; // SessionStatus::Created
session.state.unwrap; // State
session..unwrap; // None
session.set.unwrap; // None
session..unwrap; // Some(0)
session..unwrap; // Some(233)
session.save.await; // Ok(())
let session = store.get.await.unwrap; // Matches Session
session.id.unwrap; // "id.len() == 32"
session.status.unwrap; // SessionStatus::Existed
session..unwrap; // Some(0)
session..unwrap; // Some(233)
session..is_ok; // true
session.set.unwrap; // None
session..unwrap; // Option<User>
session.destroy.await; // Ok(())
session.status.unwrap; // SessionStatus::Destroyed
// or
store.remove.await; // Ok(())
Stores
- Memory
- Filesystem
- Redis
- sled
- Memcached
- Mongodb
- PostgreSQL
- MySQL/MariaDB
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.