asyncache
v0.3.1Helpers to use cachetools with async code.
4 KB Python 3.8+ py3-none-anyMIT License1 deps Likely Unmaintained
$ uv add asyncacheasyncache
Helpers to use cachetools with asyncio.
Installation
asyncache is available from PyPI_ and can be installed by running:
pip install asyncache
Example
from asyncache import cached
from cachetools import TTLCache
pool = ...
@cached(TTLCache(1024, 60))
async def get_username(user_id):
rec = await pool.fetchrow(
"""
SELECT
username
FROM
users
WHERE
id = $1
""",
user_id,
)
return rec and rec["username"]
License
This project is licensed under the MIT License - see the LICENSE_ file for details.
Acknowledgments
cachetools_
Details
- Version
- 0.3.1
- License
- MIT License
- Python
- >=3.8,<4.0
- Maintainer
- hephex
Links
Maintainers
- hephex · [email protected]