Skip to content
forked from hephex/asyncache

Helpers to use cachetools with async functions

License

Notifications You must be signed in to change notification settings

tubular/asyncache

 
 

Repository files navigation

asyncache

Helpers to use cachetools with asyncio.

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

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

About

Helpers to use cachetools with async functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%