cryo-sessions

Crates.iocryo-sessions
lib.rscryo-sessions
version0.0.4
created_at2023-09-09 16:15:47.154081+00
updated_at2023-09-10 09:54:01.147711+00
descriptionCrate for session management using Redis
homepage
repositoryhttps://github.com/reloginn/cryo-sessions
max_upload_size
id968237
size7,256
(reloginn)

documentation

https://docs.rs/cryo-sessions/latest/cryo-sessions

README

cryo-sessions

This crate is intended for people who want to store user sessions locally in Redis.

Example

use cryo_sessions::{Redis, Uuid, Session, SessionInfo};

let uuid = Uuid::new();
let redis = Redis::from_env(); // this method takes the redis url from the REDIS_URL environment variable
let session = Session::new();
redis.new_session(session.to_owned(), SessionInfo::new(uuid.to_owned(), "Mozilla(5.0)".into()), Duration::from_secs(2400)).await.is_ok();
redis.new_session(Session::new(), SessionInfo::new(uuid.to_owned(), "Apple Safari".into()), Duration::from_secs(3400)).await.is_ok();
let info = redis.get_information_by_session(session).await.unwrap();
println!("{:?}", info);
Commit count: 12

cargo fmt