(*args, **kwargs)
| 20 | |
| 21 | @ft.wraps(func) |
| 22 | def wrapper(*args, **kwargs): |
| 23 | cls = args[0] |
| 24 | if not cls.use_cache: |
| 25 | return func(*args, **kwargs) |
| 26 | key = wrapper.__cache_key__(*args[1:], **kwargs) |
| 27 | result = cls.cache.get(key, default=ENOVAL, retry=True) |
| 28 | |
| 29 | if result is ENOVAL: |
| 30 | result = func(*args, **kwargs) |
| 31 | if expire is None or expire > 0: |
| 32 | cls.cache.set(key, result, expire, tag=tag, retry=True) |
| 33 | |
| 34 | return result |
| 35 | |
| 36 | def __cache_key__(*args, **kwargs): |
| 37 | """Make key for cache given function arguments.""" |
nothing calls this directly
no outgoing calls
no test coverage detected