MyGit

actix/actix-redis

Fork: 48 Star: 109 (更新于 2024-12-21 17:05:02)

license: Apache-2.0

Language: Rust .

Redis actor and middleware for Actix

最后发布版本: v0.8.0 ( 2019-12-21 00:13:22)

GitHub网址

Actix redis Build Status codecov crates.io

Redis integration for actix framework.

NOTICE: This repository has been archived. Please visit https://github.com/actix/actix-extras instead.

Documentation

Redis session backend

Use redis as session storage.

You need to pass an address of the redis server and random value to the constructor of RedisSessionBackend. This is private key for cookie session, When this value is changed, all session data is lost.

Note that whatever you write into your session is visible by the user (but not modifiable).

Constructor panics if key length is less than 32 bytes.

use actix_web::{App, HttpServer, web, middleware};
use actix_web::middleware::session::SessionStorage;
use actix_redis::RedisSessionBackend;

#[actix_rt::main]
async fn main() -> std::io::Result {
    HttpServer::new(|| App::new()
        // enable logger
        .middleware(middleware::Logger::default())
        // cookie session middleware
        .middleware(SessionStorage::new(
            RedisSessionBackend::new("127.0.0.1:6379", &[0; 32])
        ))
        // register simple route, handle all methods
        .service(web::resource("/").to(index))
    )
    .bind("0.0.0.0:8080")?
    .start()
    .await
}

License

This project is licensed under either of

at your option.

Code of Conduct

Contribution to the actix-redis crate is organized under the terms of the Contributor Covenant, the maintainer of actix-redis, @fafhrd91, promises to intervene to uphold that code of conduct.

最近版本更新:(数据更新于 2024-10-02 02:54:43)

2019-12-21 00:13:22 v0.8.0

2019-09-25 21:29:52 v0.7.0

2019-07-19 16:11:21 v0.6.1

2019-07-11 17:05:16 v0.6.0

2018-08-03 02:49:17 v0.5.1

2018-07-21 21:55:56 v0.5.0

2018-05-09 01:50:35 v0.4.0

2018-04-11 03:23:38 v0.3.0

2018-03-01 02:16:41 v0.2.0

2018-01-24 02:08:14 v0.1.0

主题(topics):

acitx, redis

actix/actix-redis同语言 Rust最近更新仓库

2024-12-22 10:23:54 rustdesk/rustdesk

2024-12-22 08:48:41 lapce/lapce

2024-12-21 23:25:36 tw93/Pake

2024-12-19 19:31:32 dashpay/platform

2024-12-18 10:31:25 DioxusLabs/dioxus

2024-12-17 17:18:34 lanyeeee/jmcomic-downloader