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 details)
Built Distribution
File details
Details for the file asyncache-0.3.1.tar.gz
.
File metadata
- Download URL: asyncache-0.3.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0b2 CPython/3.10.7 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a1e60a75668e794657489bdea6540ee7e3259c483517b934670db7600bf5035 |
|
MD5 | 7317131664decc2ec60877dba4856b7c |
|
BLAKE2b-256 | 49cf17f8a6b6b97f77b5981fbce1266913e718daaa3467b46f60a785cbaadc29 |
File details
Details for the file asyncache-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: asyncache-0.3.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0b2 CPython/3.10.7 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef20a1024d265090dd1e0785c961cf98b9c32cc7d9478973dcf25ac1b80011f5 |
|
MD5 | ac180c57ff6d3f2018ab9ddf10221f41 |
|
BLAKE2b-256 | 2f9451927deb4f40872361ec4f5534f68f7a9ce81c4ef20bf5cd765307f4c15d |