pub trait CacheIssuer: Send + Sync + 'static {
    type Key: Hash + Eq + Send + Sync + 'static;

    // Required method
    fn issue<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        req: &'life1 mut Request,
        depot: &'life2 Depot
    ) -> Pin<Box<dyn Future<Output = Option<Self::Key>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Issuer

Required Associated Types§

source

type Key: Hash + Eq + Send + Sync + 'static

The key is used to identify the rate limit.

Required Methods§

source

fn issue<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, req: &'life1 mut Request, depot: &'life2 Depot ) -> Pin<Box<dyn Future<Output = Option<Self::Key>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Issue a new key for the request. If it returns None, the request will not be cached.

Implementors§

source§

impl CacheIssuer for RequestIssuer

§

type Key = String

source§

impl<F, K> CacheIssuer for Fwhere F: Fn(&mut Request, &Depot) -> Option<K> + Send + Sync + 'static, K: Hash + Eq + Send + Sync + 'static,

§

type Key = K