Redis backed session store for async-session using fred.rs.

Overview

async-fred-session

License: MIT docs.rs crates.io

Redis backed session store for async-session using fred.rs. This work is mostly based on async-redis-session.

use async_fred_session::RedisSessionStore;
use async_session::{Session, SessionStore};
use fred::{pool::RedisPool, prelude::*};

// pool creation
let config = RedisConfig::from_url("redis://127.0.0.1:6379").unwrap();
let rds_pool = RedisPool::new(config, 6).unwrap();
rds_pool.connect(None);
rds_pool.wait_for_connect().await.unwrap();

// store and session
let store = RedisSessionStore::from_pool(rds_pool, Some("async-fred-session/".into()));
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::<String>("key").unwrap(), "value");
You might also like...
Examples of interacting with a Polkadot node using Rust

Examples of interacting with a Polkadot node Some examples of using JSON RPC to interact with a Polkadot node, working up to manually building and sub

Download a file using multiple threads in parallel for faster download speeds.

multidl Download a file using multiple threads in parallel for faster download speeds. Uses 0 external dependencies. Usage Usage: multidl [--help] ADD

Tunnel TCP traffic through SOCKS5 or HTTP using a TUN interface.

tun2proxy Tunnel TCP traffic through SOCKS5 or HTTP on Linux. Authentication not yet supported. Error handling incomplete and too restrictive. Build C

The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL.

Graph Node The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL. Graph Node is an open s

Modrinth API is a simple library for using Modrinth's API in Rust projects

Ferinth is a simple library for using the Modrinth API in Rust projects. It uses reqwest as its HTTP(S) client and deserialises responses to typed structs using serde.

Private swaps for Secret Network using a private entropy pool & differential privacy.

WIP SecretSwap: Anon Edition Private swaps for Secret Network! Uses private entropy pool for differential privacy when reporting pools sizes. Swap amo

Proxy sentry request to a sentry server using a tunnel/proxy endpoint

Sentry Tunnel This is a proxy that forwards tunneled sentry requests to the real sentry server. The implementation is based on the explanation provide

YAC (Yac is Another Chat) is an example of Chat using WebSocket.

YAC (Yac is Another Chat) is an example of Chat using WebSocket. Because often the example you find in internet are "not so production ready", I would like to try to implement something more robust.

RusTCP is an attempt to rewrite some of the PyTCP stack functionality using Rust language.
RusTCP is an attempt to rewrite some of the PyTCP stack functionality using Rust language.

RusTCP is an attempt to rewrite some of the PyTCP stack functionality using Rust language. Currently, the main goal of this project is to create a stable IPv6 platform that could be used to facilitate the process of labing the SRv6 technology.

Releases(v0.1.2)
Owner
void*
void*
RCProxy - a lightweight, fast but powerful Redis Cluster Proxy written in Rust

RCProxy - a lightweight, fast but powerful Redis Cluster Proxy written in Rust

Cris Liao 16 Dec 4, 2022
Open Internet Service to store transaction history for NFTs/Tokens on the Internet Computer

CAP - Certified Asset Provenance Transaction history & asset provenance for NFT’s & Tokens on the Internet Computer CAP is an open internet service pr

Psychedelic 42 Nov 10, 2022
A mini async telnet client.

mini-telnet A mini async telnet client.

kolapapa 15 May 5, 2022
A minimalistic encryption protocol for rust async streams/packets, based on noise protocol and snow.

Snowstorm A minimalistic encryption protocol for rust async streams / packets, based on noise protocol and snow. Quickstart Snowstorm allows you to se

Black Binary 19 Nov 22, 2022
An async, user-friendly Let's Encrypt/ACMEv2 library written in Rust

lers An async, user-friendly Let's Encrypt/ACMEv2 library written in Rust. The API and implementation were inspired by acme2, acme-micro, and lego. Fe

Alexander Krantz 20 Apr 3, 2023
Async-friendly WebTransport implementation in Rust

WTransport WebTransport protocol, pure-rust, async-friendly. Introduction WebTransport is a new protocol being developed to enable low-latency, bidire

Biagio Festa 19 Jun 15, 2023
Cross-platform, low level networking using the Rust programming language.

libpnet Linux ∪ OS X Build Status: Windows Build Status: Discussion and support: #libpnet on freenode / #rust-networking on irc.mozilla.org / #rust on

null 1.8k Jan 6, 2023
Simple VPN implemented using rust

fubuki Simple VPN implemented using rust fubuki是类似与tincVPN的简单组网工具 不支持对等NAT 支持的平台: Windows Linux 工作机制 它由一台拥有公网IP的服务器来维持各个内网客户端的实际地址映射,在客户端和客户端之间实现P2P通信

XTY 84 Dec 31, 2022
Implementing Bendersnatch curve using Arkwork's framework in Rust.

This is a reference implementation of Bendersnatch curve using Arkwork's framework in Rust. The spec of the curve is available here. There was also a Python reference implementation here.

zhenfei 8 Jun 18, 2022
WIP / POC for using the BL602 wifi blob from Rust

BL602 Wifi Rust This is work in progress and currently more a proof of concept. The code is awfully hacked together - just enough to make it work. It

Björn Quentin 23 Sep 15, 2022