pingora_cache::key

Trait CacheHashKey

Source
pub trait CacheHashKey {
    // Required methods
    fn primary_bin(&self) -> HashBinary;
    fn variance_bin(&self) -> Option<HashBinary>;
    fn user_tag(&self) -> &str;

    // Provided methods
    fn combined_bin(&self) -> HashBinary { ... }
    fn primary(&self) -> String { ... }
    fn variance(&self) -> Option<String> { ... }
    fn combined(&self) -> String { ... }
}
Expand description

The trait for cache key

Required Methods§

Source

fn primary_bin(&self) -> HashBinary

Return the hash of the cache key

Source

fn variance_bin(&self) -> Option<HashBinary>

Return the variance hash of the cache key.

None if no variance.

Source

fn user_tag(&self) -> &str

An extra tag for identifying users

For example, if the storage backend implements per user quota, this tag can be used.

Provided Methods§

Source

fn combined_bin(&self) -> HashBinary

Return the hash including both primary and variance keys

Source

fn primary(&self) -> String

The hex string of Self::primary_bin()

Source

fn variance(&self) -> Option<String>

The hex string of Self::variance_bin()

Source

fn combined(&self) -> String

The hex string of Self::combined_bin()

Implementors§