akkudoktoreos.core.cache.cache_energy_management

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

Decorator for in memory caching the result of a callable.

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

Parameters:

callable (Callable) – The function or method to be decorated.

Returns:

The wrapped function with caching functionality.

Return type:

Callable

Example

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