Module

cache.utils

Cache management utilities for Bengal.

Functions

clear_build_cache
Clear Bengal's build cache to force a clean rebuild. Useful when: - Config changes in ways that af…
2 bool
def clear_build_cache(site_root_path: str | Path, logger: BengalLogger | None = None) -> bool

Clear Bengal's build cache to force a clean rebuild.

Useful when:

  • Config changes in ways that affect output (baseurl, theme, etc.)
  • Stale cache is suspected
  • Forcing a complete regeneration

Parameters 2

Name Type Default Description
site_root_path str | Path

Path to site root directory

logger BengalLogger | None None

Optional logger for debug output

Returns

bool

True if cache was cleared, False if no cache existed

clear_output_directory
Clear the output directory (public/) to force complete regeneration. This is necessary when build …
2 bool
def clear_output_directory(output_dir_path: str | Path, logger: BengalLogger | None = None) -> bool

Clear the output directory (public/) to force complete regeneration.

This is necessary when build artifacts may contain stale values that won't be updated by incremental builds (e.g., baseurl baked into HTML meta tags).

Parameters 2

Name Type Default Description
output_dir_path str | Path

Path to output directory (e.g., site/public)

logger BengalLogger | None None

Optional logger for debug output

Returns

bool

True if directory was cleared, False if didn't exist or error occurred