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): ...
Metadata
Release files for acachetools 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| acachetools-0.1.4.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| acachetools-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / acachetools-0.1.4.tar.gz
| Download URL | acachetools-0.1.4.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d190edb741ba2ad94e8f3460ec4f1ba6fa6b611b5bb64a5d6683793ce360969d
|
|
BLAKE2b-256 checksum How to use checksums |
5dcc986b081e0a59cb0ca20c7ebd9fe33850075922a6e5a3b99277210c589423
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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}
|
Release files / acachetools-0.1.4-py3-none-any.whl
| Download URL | acachetools-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a14385d547ec464b859b2ba420c563cc01747ae6756c2a187c496a2698ff1198
|
|
BLAKE2b-256 checksum How to use checksums |
5dc5b1200a2217611441abf71c2409a1b2cae91d26d2538c6b7f7c42db68e382
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","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}
|