betty.cache.file module

Provide caching that persists cache items to files.

final class betty.cache.file.BinaryFileCache[source]

Bases: _FileCache[bytes]

Provide a cache that persists bytes values to binary files.

This is thread-safe, which means you can safely use this between different threads.

cache_item_file_path(cache_item_id: str, suffix: str | None = None) Path[source]

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

The cache item itself may or may not exist.

property path: Path

The path to the cache’s root directory.

final class betty.cache.file.PickledFileCache[source]

Bases: _FileCache[_CacheItemValueContraT], Generic[_CacheItemValueContraT]

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

This is thread-safe, which means you can safely use this between different threads.