akkudoktoreos.core.cache.cachemethod_energy_management

akkudoktoreos.core.cache.cachemethod_energy_management(method: TCallable) TCallable

Decorator for in memory caching the result of an instance method.

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

Parameters:

method (Callable) – The instance method to be decorated.

Returns:

The wrapped method with caching functionality.

Return type:

Callable

Example

>>> class MyClass:
>>>     @cachemethod_energy_management
>>>     def expensive_method(self, param: str) -> str:
>>>         # Perform expensive computation
>>>         return f"Computed {param}"