Skip to main content

BanStore

Trait BanStore 

Source
pub trait BanStore: Send + Sync {
    // Required methods
    fn set_ban(
        &self,
        key: &str,
        expiry: f64,
        ttl_seconds: u64,
    ) -> Result<(), StoreError>;
    fn get_ban(&self, key: &str) -> Result<Option<f64>, StoreError>;
    fn delete_ban(&self, key: &str) -> Result<(), StoreError>;
}
Expand description

The reference banned_ips storage operations (the {prefix}banned_ips:{ip} namespace).

Required Methods§

Source

fn set_ban( &self, key: &str, expiry: f64, ttl_seconds: u64, ) -> Result<(), StoreError>

SET key expiry EX ttl with the expiry as unix seconds (the reference set_key("banned_ips", ip, str(expiry), ttl=duration)).

§Errors

StoreError when the backend call fails.

Source

fn get_ban(&self, key: &str) -> Result<Option<f64>, StoreError>

GET key, parsed to the stored expiry unix seconds.

§Errors

StoreError when the backend call fails.

Source

fn delete_ban(&self, key: &str) -> Result<(), StoreError>

DEL key for a stale ban (the reference _check_redis_exact).

§Errors

StoreError when the backend call fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§