parse_cache_block

Function parse_cache_block 

Source
pub fn parse_cache_block(
    header_name: Option<&str>,
    content: &str,
) -> Result<CacheDef, ConfigError>
Expand description

Parses a cache configuration YAML block and converts it into a CacheDef.

Returns an error if YAML parsing fails, if the header and payload both provide a name, or if backend/freshness values are invalid.

ยงExamples

use cellstate_pipeline::parse_cache_block;

let yaml = r#"
backend: memory
size_mb: 100
default_freshness:
  type: strict
"#;
let def = parse_cache_block(None, yaml).unwrap();
assert_eq!(def.size_mb, 100);