https://github.com/iamsauravsharma/async_deadpool_redis_session
Async session for deapool redis
https://github.com/iamsauravsharma/async_deadpool_redis_session
async cookie hacktoberfest redis rust session
Last synced: 2 months ago
JSON representation
Async session for deapool redis
- Host: GitHub
- URL: https://github.com/iamsauravsharma/async_deadpool_redis_session
- Owner: iamsauravsharma
- License: mit
- Created: 2023-08-04T10:21:28.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-01T10:53:38.000Z (over 1 year ago)
- Last Synced: 2025-03-02T01:32:50.666Z (3 months ago)
- Topics: async, cookie, hacktoberfest, redis, rust, session
- Language: Rust
- Homepage:
- Size: 1.19 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# ASYNC DEADPOOL REDIS SESSION
**Project status & info:**
| License | Crates Version | Docs |
| :--------------------------------------------: | :---------------------------------------: | :----------------------------------: |
| [![License: MIT][license_badge]][license_link] | [![Crate][cratesio_badge]][cratesio_link] | [![Docs][docsrs_badge]][docsrs_link] |Rust library built for async session store for deadpool redis
## Add as dependencies
Edit Cargo.toml file to add async_deadpool_redis_session as dependencies
```toml
[dependencies]
async_deadpool_redis_session = "0.3.0"
```## Usage
```rust
use async_deadpool_redis_session::{RedisSessionStore};
use async_deadpool_redis_session::async_session::{Session, SessionStore};
use async_deadpool_redis_session::deadpool_redis::{Config, Runtime};// pool creation
let config = Config::from_url("redis://127.0.0.1:6379").unwrap();
let redis_pool = config.create_pool(Some(Runtime::Tokio1)).unwrap();
// store and session
let store = RedisSessionStore::new(redis_pool);
let mut session = Session::new();
session.insert("key", "value").unwrap();let cookie_value = store.store_session(session).await.unwrap().unwrap();
let session = store.load_session(cookie_value).await.unwrap().unwrap();
assert_eq!(&session.get::("key").unwrap(), "value");
```[license_badge]: https://img.shields.io/github/license/iamsauravsharma/async_deadpool_redis_session.svg?style=for-the-badge
[license_link]: LICENSE
[cratesio_badge]: https://img.shields.io/crates/v/async_deadpool_redis_session.svg?style=for-the-badge
[cratesio_link]: https://crates.io/crates/async_deadpool_redis_session
[docsrs_badge]: https://img.shields.io/docsrs/async_deadpool_redis_session/latest?style=for-the-badge
[docsrs_link]: https://docs.rs/async_deadpool_redis_session