akkudoktoreos.core.cache.cache_energy_management

akkudoktoreos.core.cache.cache_energy_management(func: TCallable) TCallable

Decorator for in memory caching the result of a standalone function.

This decorator caches the function’s result in CacheEnergyManagementStore, ensuring that subsequent calls with the same arguments return the cached result until the next energy management start.

Parameters:

func (Callable) – The function to be decorated.

Returns:

The wrapped function with caching functionality.

Return type:

Callable

Example

>>> @cache_until_next_update
>>> def expensive_function(param: str) -> str:
>>>     # Perform expensive computation
>>>     return f"Computed {param}"