betty.caches.file module

Provide caching that persists cache items to files.

final class betty.caches.file.BinaryFileCache

Bases: _FileCache[bytes]

Provide a cache that persists bytes values to binary files.

cache_item_file(cache_item_id: str, suffix: str | None = None, /) Path

Get the file path for a cache item with the given ID.

The cache item itself may or may not exist.

property directory: Path

The path to the cache’s root directory.

final class betty.caches.file.PickledFileCache

Bases: _FileCache, Generic

Provide a cache that pickles values and persists them to files.