Skip to content

gutenbit._cache

_cache

Shared cache helpers for Project Gutenberg data.

cache_age_seconds(path: Path, *, now: float) -> float | None

Return cache age in seconds, or None when the file is unavailable.

default_cache_dir() -> Path

Return the default user cache directory for gutenbit.

read_cache_bytes(path: Path) -> bytes | None

Read a cache payload, treating empty or unreadable files as missing.

write_bytes_atomic(path: Path, payload: bytes) -> None

Atomically replace a cache payload.