redis-config
Implementation of Redis source as Async source for config-rs crate.
redis-config extends the list of possible sources provided by config-rs and provides an asynchronous RedisSource source using the redis-rs.
RedisSource supports reading configuration:
- from Hash using the HGETALL command,
- from String using the GET command,
- from JSON using the JSON.GET [key] $ command,
Features
There are a few features defined in redis-rs that can enable additional functionality if so desired. Some of them are turned on by default.
- ahash: enables ahash map/set support & uses ahash internally (+7-10% performance) (optional)
- tokio-comp: enables support for tokio runtime (enabled by default)
- json: enables support for JSON using the JSON.GET [key] $ command (optional)
Tls features
- tokio-native-tls-comp: enables support for native-tls for tokio (optional)
- tokio-rustls-comp: enables support for rustls for tokio (optional).
See the examples for general usage information.
Usage
Dependencies
# Cargo.toml
[]
= "0.15.6"
= { = "*", = ["tokio-comp"]}
= { = "1", = ["rt", "macros", "rt-multi-thread"] }
= { = "1.0", = ["derive"]}
Usage example
use AsyncState;
use ;
// hardcoded values, shouldn't be in production
const REDIS_URL: &str = "redis://127.0.0.1:6379";
const SOURCE_KEY: &str = "application-settings";
async
async
More
See the documentation for more usage information.
License
redis_config is primarily distributed under the terms of both the MIT license.
See LICENSE for details.