Skip to content

Instantly share code, notes, and snippets.

@siarheidevel
siarheidevel / simple_cache.py
Last active November 10, 2022 06:33
Caching decorator
import functools, logging, inspect
def cached(key:str, timeout_sec: int = 5 * 60):
"""
key - cache_key_{param1_name}_{param2_name}
timeout_sec - timeout in seconds
"""
def inner_function(function):
@functools.wraps(function)