Crates.io | redis-swapplex |
lib.rs | redis-swapplex |
version | |
source | src |
created_at | 2021-11-28 11:08:36.952341 |
updated_at | 2024-11-16 07:40:50.255554 |
description | Redis multiplexing with reconnection notifications and MGET auto-batching |
homepage | |
repository | https://github.com/Bajix/redis-swapplex/ |
max_upload_size | |
id | 488781 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Redis multiplexing with reconnection notifications and MGET auto-batching
Why use this instead of redis::aio::ConnectionManager?
Composible connection urls are provided by environment variables using env-url with the REDIS
prefix:
REDIS_URL=redis://127.0.0.1:6379
# Override env mapping for easy kubernetes config
REDIS_HOST_ENV=MONOLITH_STAGE_REDIS_MASTER_PORT_6379_TCP_ADDR
REDIS_PORT_ENV=MONOLITH_STAGE_REDIS_MASTER_SERVICE_PORT_REDIS
use redis::{AsyncCommands, RedisResult};
use redis_swapplex::get_connection;
async fn get_value(key: &str) -> RedisResult<String> {
let mut conn = get_connection();
conn.get(key).await
}
For best performance, use the Tokio runtime as configured via the tokio::main or tokio::test macro with the crate
attribute set to async_local
while the barrier-protected-runtime
feature is enabled on async-local
. Doing so configures the Tokio runtime with a barrier that rendezvous runtime worker threads during shutdown in a way that ensures tasks never outlive thread local data owned by runtime worker threads and obviates the need for Box::leak as a means of lifetime extension.