class documentation

class BaseCache:

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 No summary
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 No summary
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.
Class Variable ​_missing​_key Undocumented
Instance Variable ​_cull​_frequency Undocumented
Instance Variable ​_max​_entries Undocumented
Instance Variable default​_timeout Undocumented
Instance Variable key​_func Undocumented
Instance Variable key​_prefix Undocumented
Instance Variable version Undocumented
def __contains__(self, key):
Return True if the key is in the cache and has not expired.
def __init__(self, params):

Undocumented

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

Undocumented

async def aclear(self):

Undocumented

async def aclose(self, **kwargs):

Undocumented

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

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):

Undocumented

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

Undocumented

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

Undocumented

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

Undocumented

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

Undocumented

async def aget_many(self, keys, version=None):
See get_many().
async def aget_or_set(self, key, default, timeout=DEFAULT_TIMEOUT, version=None):
See get_or_set().
async def ahas_key(self, key, version=None):

Undocumented

async def aincr(self, key, delta=1, version=None):
See incr().
async def aincr_version(self, key, delta=1, version=None):
See incr_version().
async def aset(self, key, value, timeout=DEFAULT_TIMEOUT, version=None):

Undocumented

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

Undocumented

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

Undocumented

def clear(self):
Remove all values from the cache at once.
def close(self, **kwargs):
Close the cache connection
def decr(self, key, delta=1, version=None):
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):
Subtract delta from the cache version for the supplied key. Return the new version.
def delete(self, key, version=None):
Delete a key from the cache and return whether it succeeded, failing silently.
def delete_many(self, keys, version=None):
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):
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):
Return the timeout value usable by this backend based upon the provided timeout.
def get_many(self, keys, version=None):

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):

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):
Return True if the key is in the cache and has not expired.
def incr(self, key, delta=1, version=None):
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):
Add delta to the cache version for the supplied key. Return the new version.
def make_and_validate_key(self, key, version=None):
Helper to make and validate keys.
def make_key(self, key, version=None):
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):
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):

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):
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):
Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code.
_missing_key =

Undocumented

_cull_frequency: int =

Undocumented

_max_entries: int =

Undocumented

default_timeout =

Undocumented

key_func =

Undocumented

key_prefix =

Undocumented

version =

Undocumented