25 releases

0.6.0 Jan 2, 2024
0.5.1 Oct 10, 2023
0.5.0 Jul 26, 2023
0.4.0 Feb 18, 2023
0.0.0 Dec 17, 2019

#481 in HTTP server

Download history 38/week @ 2024-07-15 57/week @ 2024-07-22 36/week @ 2024-07-29 42/week @ 2024-08-05 33/week @ 2024-08-12 31/week @ 2024-08-19 37/week @ 2024-08-26 29/week @ 2024-09-02 33/week @ 2024-09-09 36/week @ 2024-09-16 83/week @ 2024-09-23 110/week @ 2024-09-30 41/week @ 2024-10-07 34/week @ 2024-10-14 34/week @ 2024-10-21 29/week @ 2024-10-28

144 downloads per month
Used in 2 crates

MIT/Apache

17KB
226 lines

Sessions

General sessions module for web services


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.

Dependencies

~0.5–12MB
~146K SLoC