akvo.cache.heartbeat module

class akvo.cache.heartbeat.CacheHeartbeat(cache_key: str, key_timeout: float = 30.0, beat_interval: int = 3)[source]

Bases: Thread

Thread to set a cache key with a max life and refresh it as long as the thread is alive

The thread can be ended by setting the event_end flag

calc_cache_value() str | int | float[source]

Calculate a value to be used when setting the cache key

run() None[source]

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

set_cache_value()[source]

Set the cache key and its value