CacheKey

Trait CacheKey 

Source
pub trait CacheKey: Send + Sync {
    // Required method
    fn cache_key(&self) -> String;

    // Provided methods
    fn namespace(&self) -> Option<&str> { ... }
    fn full_key(&self) -> String { ... }
}
Expand description

Trait for types that can be used as cache keys

Implement this trait to use custom types as cache keys.

Required Methods§

Source

fn cache_key(&self) -> String

Generate the key string

Provided Methods§

Source

fn namespace(&self) -> Option<&str>

Optional namespace for the key

Source

fn full_key(&self) -> String

Get the full key including namespace

Implementations on Foreign Types§

Source§

impl CacheKey for &str

Source§

impl CacheKey for &String

Source§

impl CacheKey for String

Source§

impl<T1, T2> CacheKey for (T1, T2)
where T1: Display + Send + Sync, T2: Display + Send + Sync,

Source§

impl<T1, T2, T3> CacheKey for (T1, T2, T3)
where T1: Display + Send + Sync, T2: Display + Send + Sync, T3: Display + Send + Sync,

Source§

impl<T1, T2, T3, T4> CacheKey for (T1, T2, T3, T4)
where T1: Display + Send + Sync, T2: Display + Send + Sync, T3: Display + Send + Sync, T4: Display + Send + Sync,

Source§

impl<T> CacheKey for (T,)
where T: Display + Send + Sync,

Implementors§