Two-Level Incremental Build Cache Manager.
L1 Parsing Cache: skips processing unchanged XML source files by validating file metadata (size/mtime) and content checksum.
L2 Rendering Cache: skips writing identical generated markdown/HTML targets to disk to avoid triggering SSG livereload cascades.
Instance Variables
ude.storage.BuildCacheManager.product_dirude.storage.BuildCacheManager.cache_pathude.storage.BuildCacheManager._cache
Methods
init
__init__(self, product_dir: Union)
Binds this cache manager to product_dir, loading any existing cache database.
| Parameter | Type | Description |
|---|---|---|
| product_dir | Union | Output directory this cache instance is bound to; |
save
save(self)
Saves and compresses the current cache database state to disk.
get_l1_entry
get_l1_entry(self, xml_path: Union) -> Optional[ProjectCatalog]
Returns cached ProjectCatalog if XML source file is unchanged, else None.
Returns:
The cached ProjectCatalog if its L1 entry’s mtime/size/sha256
| Parameter | Type | Description |
|---|---|---|
| xml_path | Union | Path to the XML source file to check. |
set_l1_entry
set_l1_entry(self, xml_path: Union, catalog: ProjectCatalog)
Saves ProjectCatalog metadata into the Level 1 parsing cache database.
| Parameter | Type | Description |
|---|---|---|
| xml_path | Union | Path to the XML source file that was parsed. |
| catalog | ProjectCatalog | The resulting parsed ProjectCatalog to cache. |
check_l2_hit
check_l2_hit(self, target_path: Union, entity_signature: str, template_content: str) -> bool
Returns True if Level 2 cache hits and target output file physically exists on disk.
Returns:
True if the target exists on disk and its cached signature matches.
| Parameter | Type | Description |
|---|---|---|
| target_path | Union | Path to the output file that would be written. |
| entity_signature | str | Stable hash identifying the source state behind the content. |
| template_content | str | The template content used to render the target, for hashing. |
set_l2_entry
set_l2_entry(self, target_path: Union, entity_signature: str, template_content: str)
Records rendering target signatures inside Level 2 rendering cache database.
| Parameter | Type | Description |
|---|---|---|
| target_path | Union | Path to the output file that was written. |
| entity_signature | str | Stable hash identifying the source state behind the content. |
| template_content | str | The template content used to render the target, for hashing. |
write_if_changed
write_if_changed(self, target_path: Union, content: str, entity_signature: str, template_content: str) -> bool
Writes content to disk only if Level 2 rendering signatures differ, preventing redundant I/O.
Returns:
True if write was executed, False if skipped.
| Parameter | Type | Description |
|---|---|---|
| target_path | Union | Path to the output file to write. |
| content | str | The fully rendered content to persist. |
| entity_signature | str | Stable hash identifying the source state behind the content. |
| template_content | str | The template content used to render the target, for hashing. |
_load_cache
_load_cache(self) -> BuildCache
Loads and decompresses the persistent cache database from disk.
Returns:
The loaded BuildCache, or an empty one if the cache file is