class, name, timeout=None, to_force=False, bsize=16777216, purge_int=15)[source]

Bases: object

Imlementation of the cache dictionary

GLOB_DB_NAME = 'global.db'

Empty a database



get(key, default=None)[source]

Get a value stored in the cache for a given key

If the record has expired, the default value is returned. :param key: The key to be search in the cache :param default: Value to return if the record is not present. :return: The value or default


Remove expired records from the cache

First, the function prepare a set of timestamps to remove and then it will remove them. This prevents the process to hold a write cursor for long time and block other processes during cache purge. :return: None

set(key, value, timeout=None)[source]

Store a key/value pair to the cache

If the key already exists in the cache, the previous value is replaced. The key and value must be pickable objects.

  • key – The key to be used

  • value – The value to be stored

  • timeout (int) – Override default timeout value (seconds)




Bases: BaseException

Custom cache exception

class, updates=None)[source]

Bases: object

Class representing a custom CacheManager capable of understanding and parsing Mentat system core configuration and enabling easy bootstrapping of

cache(name, timeout=None, to_force=False)[source]

Return handle to a cache according to internal configuration and user defined parameters

For a detailed description of parameters, see . :param str name: Name of the cache to create/load :param int timeout: Default record timeout (seconds) or None :param bool to_force: Overwrite current timeout, if defined :return: Reference to the cache object :rtype: