asyncache 0.3.1


pip install asyncache

  Latest version

Released: Nov 15, 2022

Project Links

Meta
Author: hephex
Requires Python: >=3.8,<4.0

Classifiers

License
  • OSI Approved :: MIT License

Programming Language
  • Python :: 3
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10

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 https://img.shields.io/badge/code%20style-black-000000.svg

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

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
cachetools (<6.0.0,>=5.2.0)