| Crates.io | cryo-sessions |
| lib.rs | cryo-sessions |
| version | 0.0.4 |
| created_at | 2023-09-09 16:15:47.154081+00 |
| updated_at | 2023-09-10 09:54:01.147711+00 |
| description | Crate for session management using Redis |
| homepage | |
| repository | https://github.com/reloginn/cryo-sessions |
| max_upload_size | |
| id | 968237 |
| size | 7,256 |
This crate is intended for people who want to store user sessions locally in Redis.
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);