store.cache.backends.base
=========================

.. py:module:: store.cache.backends.base


Attributes
----------

.. autoapisummary::

   store.cache.backends.base.DEFAULT_TIMEOUT


Classes
-------

.. autoapisummary::

   store.cache.backends.base.Cache


Module Contents
---------------

.. py:data:: DEFAULT_TIMEOUT
   :value: 86400


.. py:class:: Cache(cache_configuration: Any)

   .. py:attribute:: cache_configuration


   .. py:method:: get(uid: str, default: Any = None) -> Any
      :abstractmethod:


      Fetch a given resource from the cache.

      If the resource does not exist, return default, which itself defaults
      to None.
      :param uid: the resource uid
      :param default: the default value if not found



   .. py:method:: get_expiry_time(timeout: int = DEFAULT_TIMEOUT) -> float

      Return the expiry time based upon the provided timeout.

      :param timeout: timeout



   .. py:method:: has_resource(uid: str) -> bool

      Return True if the uid is in the cache and has not expired.

      :param uid: the resource uid



   .. py:method:: set(uid: str, value: Any, timeout: int = DEFAULT_TIMEOUT) -> bool
      :abstractmethod:


      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, otherwise the
          default cache timeout will be used.
      :return: True if the value is set, False in case of failure



   .. py:method:: delete(uid: str) -> None
      :abstractmethod:


      Delete a resource from the cache.

      Do nothing if the uid does not exist.
      :param uid: the resource uid



   .. py:method:: clear() -> None
      :abstractmethod:


      Remove *all* values from the cache at once.



   .. py:method:: close() -> None

      Close the cache connection.



   .. py:method:: __contains__(uid: str) -> bool

      Return True if the resource is in the cache and has not expired.

      :param uid: the resource uid



