Skip to main content

acachetools provides asyncio-compatible versions of cachetools.cached() and cachetools.cachedmethod(), with support for cachetools cache implementations such as TTLCache and LRUCache. Concurrent calls for the same cache key share a single in-flight computation, preventing cache stampedes.

Installation

pip install acachetools

Usage

cached

from cachetools import TTLCache
from acachetools import cached

@cached(cache=TTLCache(maxsize=1024, ttl=600))
async def some_func(value: int):
    ...

cachedmethod

from cachetools import LRUCache
from acachetools import cachedmethod


class SomeClass:
    def __init__(self):
        self.cache = LRUCache(maxsize=128)

    @cachedmethod(lambda self: self.cache)
    async def some_func(self, value: int):
        ...

Download files

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

Source Distribution

acachetools-0.1.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

acachetools-0.1.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file acachetools-0.1.2.tar.gz.

File metadata

  • Download URL: acachetools-0.1.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for acachetools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 995d9ad8b1eb250e3dc10c2543646255409ead966cb2631dd352e567ed73c0c1
MD5 b3e37dadaed40cda9ef2c89996bbdfbd
BLAKE2b-256 bca63b40a9ad279e323b65aafd58181432e194342d9a0bcc08a6c50625838c00

See more details on using hashes here.

File details

Details for the file acachetools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: acachetools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for acachetools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a548cb4113883d23c2e2873ff06ddb7afc2f079b4349dafb4fa223d01ca3f77e
MD5 f3be9f39e47053a2a3569ee3a1ae8133
BLAKE2b-256 22b284f83800f37c1901d0df87021b11d03d90021811a554e65c1eaccd4ee52c

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