Decorator to cache async function results
Caching decorator for async functions
This is a replacement for
@cached() decorator from
cachetools does not support async at the time of writing.
pip install async-cached
from cachetools import LRUCache from asynccached import asynccached _cache = LRUCache(maxsize=1) @asynccached(cache=_cache, key=lambda arg: arg) async def func(arg): pass
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.