kvarn::vary

Struct Settings

source
pub struct Settings { /* private fields */ }
Expand description

The rules for handling and caching a request/response.

Implementations§

source§

impl Settings

source

pub fn empty() -> Self

Returns an empty set of rules. Will not cache any variants, except compressed.

source

pub fn add_rule( self, request_header: &'static str, transformation: impl Fn(&str) -> Cow<'static, str> + Send + Sync + 'static, default: &'static str, ) -> Self

Add a custom rule.

The request_header is used when outputting the vary header and for the internal cache.

transformation takes request_header and (hopefully, for performance) narrows the variants down