Skip to main content

CacheStatusExt

Trait CacheStatusExt 

Source
pub trait CacheStatusExt {
    type Config;

    // Required method
    fn cache_status(&mut self, status: CacheStatus, config: &Self::Config);
}
Expand description

Extension trait for enriching responses with cache status information.

This trait provides a protocol-agnostic way to attach cache status metadata to responses. Each protocol (HTTP, gRPC, etc.) implements this trait with its own configuration type.

§Example

use hitbox_core::{CacheStatus, CacheStatusExt};

// For HTTP responses (implemented in hitbox-http)
response.cache_status(CacheStatus::Hit, &header_name);

Required Associated Types§

Source

type Config

Configuration type for applying cache status (e.g., header name for HTTP).

Required Methods§

Source

fn cache_status(&mut self, status: CacheStatus, config: &Self::Config)

Applies cache status information to the response.

Implementors§