class documentation

class BaseCache: (source)

View In Hierarchy

Undocumented

Method __contains__ Return True if the key is in the cache and has not expired.
Method __init__ Undocumented
Async Method aadd Undocumented
Async Method aclear Undocumented
Async Method aclose Undocumented
Method add Set a value in the cache if the key does not already exist. If timeout is given, use that timeout for the key; otherwise use the default cache timeout.
Async Method adecr Undocumented
Async Method adecr_version Undocumented
Async Method adelete Undocumented
Async Method adelete_many Undocumented
Async Method aget Undocumented
Async Method aget_many See get_many().
Async Method aget_or_set See get_or_set().
Async Method ahas_key Undocumented
Async Method aincr See incr().
Async Method aincr_version See incr_version().
Async Method aset Undocumented
Async Method aset_many Undocumented
Async Method atouch Undocumented
Method clear Remove *all* values from the cache at once.
Method close Close the cache connection
Method decr Subtract delta from value in the cache. If the key does not exist, raise a ValueError exception.
Method decr_version Subtract delta from the cache version for the supplied key. Return the new version.
Method delete Delete a key from the cache and return whether it succeeded, failing silently.
Method delete_many Delete a bunch of values in the cache at once. For certain backends (memcached), this is much more efficient than calling delete() multiple times.
Method get Fetch a given key from the cache. If the key does not exist, return default, which itself defaults to None.
Method get_backend_timeout Return the timeout value usable by this backend based upon the provided timeout.
Method get_many Fetch a bunch of keys from the cache. For certain backends (memcached, pgsql) this can be *much* faster when fetching multiple values.
Method get_or_set Fetch a given key from the cache. If the key does not exist, add the key and set it to the default value. The default value can also be any callable. If timeout is given, use that timeout for the key; otherwise use the default cache timeout.
Method has_key Return True if the key is in the cache and has not expired.
Method incr Add delta to value in the cache. If the key does not exist, raise a ValueError exception.
Method incr_version Add delta to the cache version for the supplied key. Return the new version.
Method make_and_validate_key Helper to make and validate keys.
Method make_key Construct the key used by all other methods. By default, use the key_func to generate a key (which, by default, prepends the `key_prefix' and 'version'). A different key function can be provided at the time of cache construction; alternatively, you can subclass the cache backend to provide custom key making behavior.
Method set Set a value in the cache. If timeout is given, use that timeout for the key; otherwise use the default cache timeout.
Method set_many Set a bunch of values in the cache at once from a dict of key/value pairs. For certain backends (memcached), this is much more efficient than calling set() multiple times.
Method touch Update the key's expiry time using timeout. Return True if successful or False if the key does not exist.
Method validate_key Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code.
Instance Variable default_timeout Undocumented
Instance Variable key_func Undocumented
Instance Variable key_prefix Undocumented
Instance Variable version Undocumented
Class Variable _missing_key Undocumented
Instance Variable _cull_frequency Undocumented
Instance Variable _max_entries Undocumented
def __contains__(self, key): (source)

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

def __init__(self, params): (source)

Undocumented

async def aadd(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): (source)

Undocumented

async def aclear(self): (source)

Undocumented

async def aclose(self, **kwargs): (source)

Undocumented

def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): (source)

Set a value in the cache if the key does not already exist. If timeout is given, use that timeout for the key; otherwise use the default cache timeout. Return True if the value was stored, False otherwise.

async def adecr(self, key, delta=1, version=None): (source)

Undocumented

async def adecr_version(self, key, delta=1, version=None): (source)

Undocumented

async def adelete(self, key, version=None): (source)

Undocumented

async def adelete_many(self, keys, version=None): (source)

Undocumented

async def aget(self, key, default=None, version=None): (source)

Undocumented

async def aget_many(self, keys, version=None): (source)

See get_many().

async def aget_or_set(self, key, default, timeout=DEFAULT_TIMEOUT, version=None): (source)

See get_or_set().

async def ahas_key(self, key, version=None): (source)

Undocumented

async def aincr(self, key, delta=1, version=None): (source)

See incr().

async def aincr_version(self, key, delta=1, version=None): (source)

See incr_version().

async def aset(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): (source)

Undocumented

async def aset_many(self, data, timeout=DEFAULT_TIMEOUT, version=None): (source)

Undocumented

async def atouch(self, key, timeout=DEFAULT_TIMEOUT, version=None): (source)

Undocumented

def clear(self): (source)

Remove *all* values from the cache at once.

def close(self, **kwargs): (source)

Close the cache connection

def decr(self, key, delta=1, version=None): (source)

Subtract delta from value in the cache. If the key does not exist, raise a ValueError exception.

def decr_version(self, key, delta=1, version=None): (source)

Subtract delta from the cache version for the supplied key. Return the new version.

def delete(self, key, version=None): (source)

Delete a key from the cache and return whether it succeeded, failing silently.

def delete_many(self, keys, version=None): (source)

Delete a bunch of values in the cache at once. For certain backends (memcached), this is much more efficient than calling delete() multiple times.

def get(self, key, default=None, version=None): (source)

Fetch a given key from the cache. If the key does not exist, return default, which itself defaults to None.

def get_backend_timeout(self, timeout=DEFAULT_TIMEOUT): (source)

Return the timeout value usable by this backend based upon the provided timeout.

def get_many(self, keys, version=None): (source)

Fetch a bunch of keys from the cache. For certain backends (memcached, pgsql) this can be *much* faster when fetching multiple values. Return a dict mapping each key in keys to its value. If the given key is missing, it will be missing from the response dict.

def get_or_set(self, key, default, timeout=DEFAULT_TIMEOUT, version=None): (source)

Fetch a given key from the cache. If the key does not exist, add the key and set it to the default value. The default value can also be any callable. If timeout is given, use that timeout for the key; otherwise use the default cache timeout. Return the value of the key stored or retrieved.

def has_key(self, key, version=None): (source)

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

def incr(self, key, delta=1, version=None): (source)

Add delta to value in the cache. If the key does not exist, raise a ValueError exception.

def incr_version(self, key, delta=1, version=None): (source)

Add delta to the cache version for the supplied key. Return the new version.

def make_and_validate_key(self, key, version=None): (source)

Helper to make and validate keys.

def make_key(self, key, version=None): (source)

Construct the key used by all other methods. By default, use the key_func to generate a key (which, by default, prepends the `key_prefix' and 'version'). A different key function can be provided at the time of cache construction; alternatively, you can subclass the cache backend to provide custom key making behavior.

def set(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): (source)

Set a value in the cache. If timeout is given, use that timeout for the key; otherwise use the default cache timeout.

def set_many(self, data, timeout=DEFAULT_TIMEOUT, version=None): (source)

Set a bunch of values in the cache at once from a dict of key/value pairs. For certain backends (memcached), this is much more efficient than calling set() multiple times. If timeout is given, use that timeout for the key; otherwise use the default cache timeout. On backends that support it, return a list of keys that failed insertion, or an empty list if all keys were inserted successfully.

def touch(self, key, timeout=DEFAULT_TIMEOUT, version=None): (source)

Update the key's expiry time using timeout. Return True if successful or False if the key does not exist.

def validate_key(self, key): (source)

Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code.

default_timeout = (source)

Undocumented

key_func = (source)

Undocumented

key_prefix = (source)

Undocumented

Undocumented

_missing_key = (source)

Undocumented

_cull_frequency = (source)

Undocumented

_max_entries = (source)

Undocumented