Skip to main content

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

Release files for asyncache 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncache 0.3.1
File Size Uploaded
asyncache-0.3.1.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asyncache 0.3.1
File Interpreter ABI Platform
asyncache-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / asyncache-0.3.1.tar.gz

Download URL asyncache-0.3.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9a1e60a75668e794657489bdea6540ee7e3259c483517b934670db7600bf5035
BLAKE2b-256 checksum
How to use checksums
49cf17f8a6b6b97f77b5981fbce1266913e718daaa3467b46f60a785cbaadc29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0b2 CPython/3.10.7 Darwin/21.6.0

Release files / asyncache-0.3.1-py3-none-any.whl

Download URL asyncache-0.3.1-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef20a1024d265090dd1e0785c961cf98b9c32cc7d9478973dcf25ac1b80011f5
BLAKE2b-256 checksum
How to use checksums
2f9451927deb4f40872361ec4f5534f68f7a9ce81c4ef20bf5cd765307f4c15d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.0b2 CPython/3.10.7 Darwin/21.6.0

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page