Skip to main content

RedisClient

Trait RedisClient 

Source
pub trait RedisClient:
    Send
    + Sync
    + Debug {
    // Required method
    fn incr_with_ttl(
        &self,
        key: &str,
        ttl_secs: u64,
    ) -> Result<u64, ServerError>;
}
Available on crate feature distributed-rate-limit only.
Expand description

Minimal Redis-like client contract.

§Examples

use http_handle::distributed_rate_limit::RedisClient;
assert_eq!(1, 1);

§Panics

Trait usage does not panic by itself.

Required Methods§

Source

fn incr_with_ttl(&self, key: &str, ttl_secs: u64) -> Result<u64, ServerError>

Increments key, sets TTL as needed, and returns current count.

Implementors§