sessions

Crates.iosessions
lib.rssessions
version0.6.0
sourcesrc
created_at2019-12-17 04:28:46.455886
updated_at2024-01-02 08:10:40.509396
descriptionGeneral sessions module for web services
homepagehttps://github.com/viz-rs/sessions
repositoryhttps://github.com/viz-rs/sessions
max_upload_size
id189929
size9,942
Fangdun Tsai (fundon)

documentation

https://docs.rs/sessions

README

Sessions

General sessions module for web services


Safety! Docs.rs docs Crates.io version Download Discord Twitter: @_fundon

Features

  • Async/await

  • Easy custom Storages

  • Stores the values in a BTreeMap<String, Value>

Example

sessions = { version = "0.4", features = ["memory"] }
use std::sync::Arc;
use sessions::*;

let config = Arc::new(Store::new(
  MemoryStorage::new(),
  nano_id::base64::<32>,
  |sid: &str| sid.len() == 32,
));


let session = Session::new(Data::new());
session.set::<String>("crate", "sessions".to_string());
let val: Option<String> = session.get("crate");
session.remove("crate");
session.clear();

Storages

  • Memory
  • Redis
  • SQLx
    • SQLite
    • PostgreSQL
    • MySQL/MariaDB
  • Memcached
  • Mongodb

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 74

cargo fmt