Caching#

nrk_psapi.caching.get_cache()[source]#

Get the context object that contains previously-computed return values.

nrk_psapi.caching.cache(expire=3600, typed=False, ignore=())[source]#

Cache decorator for memoizing function calls.

Parameters:
  • expire (float | None) – Time in seconds before cache expires

  • typed – Use type information for cache key

  • ignore – Positional or keyword arguments to ignore

nrk_psapi.caching.set_cache_dir(cache_dir)[source]#

Set a custom cache directory.

Parameters:

cache_dir (str)

nrk_psapi.caching.disable_cache()[source]#

Disable the cache for this session.

nrk_psapi.caching.clear_cache()[source]#

Erase the cache completely.

nrk_psapi.caching.cache_disabled()[source]#

Context manager to temporarily disable caching.