Skip to main content

Helpers to use cachetools with async code.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asyncache-0.2.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncache-0.2.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file asyncache-0.2.0.tar.gz.

File metadata

  • Download URL: asyncache-0.2.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b2 CPython/3.10.7 Darwin/21.6.0

File hashes

Hashes for asyncache-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a3db467fb172c0b53850e44975650ca98aa6291d63ed80c3d57d503dfeea5c6f
MD5 62e2de9fd2c96edc5a540bb1b03332ab
BLAKE2b-256 aeac20c921d58d3a5cffe27cc11bbde8dfa11e930455f6bfa14dbb247c160f93

See more details on using hashes here.

File details

Details for the file asyncache-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: asyncache-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b2 CPython/3.10.7 Darwin/21.6.0

File hashes

Hashes for asyncache-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 357c085016058c6f4294b7f4517af8b2eaf79f3c6bc7b580492649d7893afa69
MD5 d11a89a513077c3fd3404105ebbfb5e1
BLAKE2b-256 8a1abab0d71795efa1ba4c4941d6695fe8a7458904ebabf34504f73550cf9b88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page