# cache

URL: /kida/api/analysis/cache/
Section: analysis
Description: Cache scope inference for template blocks.

Determines recommended caching granularity based on dependencies and purity.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/analysis/cache/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fcache%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fcache%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fcache%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fcache%2Findex.txt)

Module

#
`analysis.cache`

Cache scope inference for template blocks.

Determines recommended caching granularity based on dependencies and purity.

2Functions

## Functions

`infer_cache_scope`

3

`CacheScope`

▼

Infer recommended cache scope for a block.

`def infer_cache_scope(depends_on: frozenset[str], is_pure: Literal['pure', 'impure', 'unknown'], config: AnalysisConfig | None = None) -> CacheScope`

##### Parameters

Name
Type
Description

`depends_on`
`frozenset[str]`

Context paths the block depends on.

`is_pure`
`Literal['pure', 'impure', 'unknown']`

Block purity level.

`config`
`AnalysisConfig | None`

Analysis configuration (for naming conventions).

Default:`None`

##### Returns

`CacheScope`

`_has_prefix_match`

2

`bool`

▼

Check if any path starts with any prefix.

Handles both "page." (prefix) and "p…

`def _has_prefix_match(paths: frozenset[str], prefixes: frozenset[str]) -> bool`

Check if any path starts with any prefix.

Handles both "page." (prefix) and "page" (exact match) patterns.

##### Parameters

Name
Type
Description

`paths`
`frozenset[str]`

`prefixes`
`frozenset[str]`

##### Returns

`bool`
