betty.cache.file module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.cache.file module

Provide caching that persists cache items to files.

class betty.cache.file.BinaryFileCache

  Bases: `_FileCache`[`bytes`]

  Provide a cache that persists bytes values to binary files.

  Parameters:

    - localizer (`betty.locale.Localizer`)

    - cache_directory_path (`pathlib.Path`)

    - scopes (`collections.abc.Sequence`[`str`] | `None`)

  cache_item_file_path(cache_item_id: str) → pathlib.Path

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

    The cache item itself may or may not exist.

    Parameters:

      cache_item_id (`str`)

    Return type:

      `pathlib.Path`

  property path: Path

    The path to the cache’s root directory.

class betty.cache.file.PickledFileCache

  Bases: `_FileCache`[`CacheItemValueContraT`], `Generic`[`CacheItemValueContraT`]

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

  Parameters:

    - localizer (`betty.locale.Localizer`)

    - cache_directory_path (`pathlib.Path`)

    - scopes (`collections.abc.Sequence`[`str`] | `None`)