MCPcopy Create free account
hub / github.com/LeenHawk/sgproxy / count_cache_controls_in_content

Function count_cache_controls_in_content

src/proxy.rs:1029–1040  ·  view source on GitHub ↗
(content: &Value)

Source from the content-addressed store, hash-verified

1027}
1028
1029fn count_cache_controls_in_content(content: &Value) -> usize {
1030 match content {
1031 Value::Array(items) => items
1032 .iter()
1033 .filter(|item| block_has_direct_cache_control(item))
1034 .count(),
1035 Value::Object(map) => usize::from(
1036 map.contains_key("cache_control") && block_supports_direct_cache_control(map),
1037 ),
1038 _ => 0,
1039 }
1040}
1041
1042fn block_has_direct_cache_control(block: &Value) -> bool {
1043 block.as_object().is_some_and(|map| {

Callers 1

Tested by

no test coverage detected