Skip to content
Snippets Groups Projects
Adam Cecile's avatar
Adam Cecile authored
python-asyncache (0.1.1-1) unstable; urgency=medium

  * Initial release (Closes: #983501).
a00e764e
History

asyncache

Helpers to use cachetools with asyncio.

https://travis-ci.org/hephex/asyncache.svg?branch=master https://coveralls.io/repos/github/hephex/asyncache/badge.svg?branch=master

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