:py:mod:`store.cache.backends.filecache` ======================================== .. py:module:: store.cache.backends.filecache .. autoapi-nested-parse:: File-based cache backend for store. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: store.cache.backends.filecache.FileCache .. py:class:: FileCache(cache_configuration: Any) Bases: :py:obj:`e3.store.cache.backends.base.Cache` File-based cache backend implementation. :ivar cache_dir: directory where cache files are stored .. py:attribute:: cache_suffix :value: '.cache' .. py:method:: clear() -> None Clear. .. py:method:: delete(uid: str) -> None Delete. .. py:method:: _create_cache_dir() -> None .. py:method:: uid_to_file(uid: str) -> str Convert a resource uid to a cache file path. This backend assumes that the uid is a safe value for a file name. :param uid: the resource uid :return: path to the cache file for the given uid .. py:method:: _is_expired(fd: IO[bytes]) -> bool :staticmethod: Determine if an open cache file has expired. Automatically delete the file if it has passed its expiry time. :param fd: open file descriptor to check :return: True if the cache file has expired, False otherwise .. py:method:: get(uid: str, default: Any = None) -> Any Fetch a given resource from the cache. :param uid: the resource uid :param default: the default value if not found :return: the cached value or default if not found or expired .. py:method:: set(uid: str, value: Any, timeout: int = DEFAULT_TIMEOUT) -> bool Set a value in the cache. :param uid: the cache entry uid :param value: the object to cache :param timeout: timeout to use for caching this value :return: True if the value is set, False in case of failure