Helpers to use cachetools with async code.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncache-0.3.1.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for asyncache-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef20a1024d265090dd1e0785c961cf98b9c32cc7d9478973dcf25ac1b80011f5 |
|
MD5 | ac180c57ff6d3f2018ab9ddf10221f41 |
|
BLAKE2b-256 | 2f9451927deb4f40872361ec4f5534f68f7a9ce81c4ef20bf5cd765307f4c15d |