preheat_open.cache.load_from_cache

preheat_open.cache.load_from_cache(id, expiry_s=None, path='.cache/')

Loads data from the on-disk cache.

WARNING: this method loads data from a file using pickle, which may execute code at the time of loading.

Make sure to load only files that you generated yourself or trust in order to avoid execution of malicious code.

Parameters:
  • id (str) – cache identifier

  • expiry_s (Optional[int]) – acceptable lifetime of the cache (in s)

  • path (str) – path in which to cache the data

Return type:

tuple[Any, bool]

Returns:

tuple of: data loaded from cache (or None if non-existent) and indicator of whether data was loaded