px
pypx

asyncache

v0.3.1

Helpers to use cachetools with async code.

4 KB Python 3.8+ py3-none-anyMIT License1 deps Likely Unmaintained
Diff
$ uv add asyncache
asyncache

Helpers to use cachetools with asyncio.

Latest PyPI version

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

Maintainers