MyGit

actix/actix-redis

Fork: 48 Star: 110 (更新于 2024-11-02 03:29:41)

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-11-22 05:42:56 lanyeeee/jmcomic-downloader

2024-11-19 23:39:15 gleam-lang/gleam

2024-11-19 08:50:55 lapce/lapce

2024-11-11 22:51:00 tauri-apps/tauri

2024-11-11 07:55:30 dani-garcia/vaultwarden

2024-11-09 16:42:37 rustdesk/rustdesk