pub struct CacheConfig {
pub ttl: Option<Duration>,
pub auto_refresh: bool,
}Expand description
Parsed cache config. Built from spec::source::CacheConfig (which carries
the raw YAML strings) so the resolver doesn’t have to re-parse humantime
formats on every fetch.
Fields§
§ttl: Option<Duration>TTL parsed via humantime ("30s", "5m", "6h", "1d", "7d").
None → default TTL applies.
auto_refresh: boolComponent-layer hint — the resolver doesn’t auto-refresh, but the flag is preserved end-to-end so consumers (Leptos, React) can read it.
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn from_spec(
spec: Option<&SpecCacheConfig>,
) -> Result<Option<Self>, ChartError>
pub fn from_spec( spec: Option<&SpecCacheConfig>, ) -> Result<Option<Self>, ChartError>
Parse a spec::source::CacheConfig (the raw YAML form) into the
resolver-friendly shape. Returns Ok(None) when the input is None
so the upstream Option plumbing stays clean. Returns Err when the
declared TTL string is present but unparseable — silent fallback to
DEFAULT_TTL would let an operator’s typo ("5 minutes" instead of
"5m") ship to production unnoticed, so the parser’s complaint is
surfaced to the caller verbatim.
Sourcepub fn ttl_duration(&self) -> Option<Duration>
pub fn ttl_duration(&self) -> Option<Duration>
Convenience accessor matching the design doc’s ttl_duration() name.
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more