p3exporter.cache package

Module that defines all needed classes and functions for caching facility.

p3exporter.cache.timed_lru_cache(lifetime: int = 3600, maxsize: int = 128)[source]

Provide cache with a given lifetime.

This function has to be used as decorator.

Each time the the cache will be accessed the decorator checks current date is past experation date. If so, the cache will cleared and the new expiration data will be recomputed. If not the cache entry will be delivered.

Parameters
  • lifetime (int, optional) – The lifetime of cache in seconds, defaults to 3600

  • maxsize (int, optional) – The maximum number of cache items, defaults to 128