Source code for zsl.cache.cache_module

"""
:mod:`zsl.cache.cache_module`
-----------------------------

.. moduleauthor:: Martin Babka
"""
import abc


[docs] class CacheModule(metaclass=abc.ABCMeta): """ Cache abstraction layer - module for caching. """
[docs] @abc.abstractmethod def set_key(self, key, value, timeout): """ Saves the ``key``-``value`` pair for ``timeout`` seconds. """ pass
[docs] @abc.abstractmethod def invalidate_key(self, key): """ Deletes the ``key``. """ pass
[docs] @abc.abstractmethod def contains_key(self, key): """ Check if the ``key`` is contained in the cache. """ pass
[docs] @abc.abstractmethod def get_key(self, key): """ Returns the value associated with the ``key``. TODO this should be named get_by_key or just simply get(key), get_key sounds like it would return a key """ pass
[docs] @abc.abstractmethod def contains_list(self, key): """ Check if the ``key`` is in the cache. """ pass
[docs] @abc.abstractmethod def get_list(self, key): """ Returns the list associated with the ``key``. """ pass
[docs] @abc.abstractmethod def invalidate_by_glob(self, glob): """ Invalidates the keys by given glob. :param string glob: All the keys matching the given glob will be invalidated. """