Request Cache

This module provides cache functionality.

class flask_ipernity.cache.CachedIpernityAPI(timeout: int = 300, *args: Any, **kwargs: Any)[source]

Bases: IpernityAPI

Wrapper for IpernityAPI that caches requests in the Flask session.

Parameters:
  • timeout – Time in seconds that cached results are considered valid.

  • args – Passed to IpernityAPI.

  • kwargs – Passed to IpernityAPI.

call(method_name: str, **kwargs: Any) Dict[source]

Makes an API call and caches the result.

The results are stored in the cache property.

property cache: Dict

Dict for storing the cache.

This gives you direct access to the session variable containing the cached data. When modifying the dict, make sure to set modified so that the changes will be saved.