Classes
RenderedOutputCacheMixin
Mixin providing rendered output caching (Optimization #3).
Requires these attributes on the host c…
RenderedOutputCacheMixin
Mixin providing rendered output caching (Optimization #3).
Requires these attributes on the host class:
- rendered_output: dict[str, dict[str, Any]]
- is_changed: Callable[[Path], bool] (from FileTrackingMixin)
Attributes
| Name | Type | Description |
|---|---|---|
rendered_output |
dict[str, dict[str, Any]] |
Methods 5
is_changed
Check if file changed (provided by FileTrackingMixin).
is_changed
def is_changed(self, file_path: Path) -> bool
Check if file changed (provided by FileTrackingMixin).
Parameters 1
file_path |
Path |
Returns
bool
store_rendered_output
Store fully rendered HTML output in cache.
This allows skipping BOTH markdown …
store_rendered_output
def store_rendered_output(self, file_path: Path, html: str, template: str, metadata: dict[str, Any], dependencies: list[str] | None = None) -> None
Store fully rendered HTML output in cache.
This allows skipping BOTH markdown parsing AND template rendering for pages where content, template, and metadata are unchanged. Expected to provide 20-40% faster incremental builds.
Parameters 5
file_path |
Path |
Path to source file |
html |
str |
Fully rendered HTML (post-template, ready to write) |
template |
str |
Template name used for rendering |
metadata |
dict[str, Any] |
Page metadata (frontmatter) |
dependencies |
list[str] | None |
List of template/partial paths this page depends on |
get_rendered_output
Get cached rendered HTML if still valid.
Validates that:
1. Content file hasn'…
get_rendered_output
def get_rendered_output(self, file_path: Path, template: str, metadata: dict[str, Any]) -> str | None
Get cached rendered HTML if still valid.
Validates that:
- Content file hasn't changed (via file_fingerprints)
- Metadata hasn't changed (via metadata_hash)
- Template name matches
- Template files haven't changed (via dependencies)
- Config hasn't changed (caller should validate config_hash)
Parameters 3
file_path |
Path |
Path to source file |
template |
str |
Current template name |
metadata |
dict[str, Any] |
Current page metadata |
Returns
Cached HTML string if valid, None if invalid or not foundstr | None
—
invalidate_rendered_output
Remove cached rendered output for a file.
invalidate_rendered_output
def invalidate_rendered_output(self, file_path: Path) -> None
Remove cached rendered output for a file.
Parameters 1
file_path |
Path |
Path to file |
get_rendered_output_stats
Get rendered output cache statistics.
get_rendered_output_stats
def get_rendered_output_stats(self) -> dict[str, Any]
Get rendered output cache statistics.
Returns
Dictionary with cache statsdict[str, Any]
—