TimedCache#
- class wattson.util.performance.timed_cache.TimedCache(cache_refresh_callback: Callable, cache_timeout_seconds: float, set_initial_content: bool = False, initial_content: Any = None, async_refresh: bool = True)#
Bases:
objectMethods
Returns the cache's content.
Returns the cache's content.
is_refresh_requiredis_up_to_dateset_outdated- __init__(cache_refresh_callback: Callable, cache_timeout_seconds: float, set_initial_content: bool = False, initial_content: Any = None, async_refresh: bool = True)#
- get_content(*args, **kwargs) Any#
Returns the cache’s content. If the content is outdated, calls the refresh callback first.
- Parameters:
*args –
**kwargs –
- Returns:
The cache’s (updated) content
- Return type:
Any
- get_raw_content() Any#
Returns the cache’s content. This does not update the content.
- Returns:
The cache’s (potentially outdated) content
- Return type:
Any