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.3
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.3.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| acachetools-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.3 kB
Release files / acachetools-0.1.3.tar.gz
| Download URL | acachetools-0.1.3.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
389370a842e0377848270d6814be029901615e87cb3972e9a240765106b2b091
|
|
BLAKE2b-256 checksum How to use checksums |
aa7f711d2bab833e578e2ff3675c45393ca7892fcb9bd12b168ce76455bce931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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.3-py3-none-any.whl
| Download URL | acachetools-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f5794043f9ecafda16396667215ae02ab0912a04dcf620ce8c261f8dd3184a2
|
|
BLAKE2b-256 checksum How to use checksums |
0fa2c92c64f1dd6cefd212338cd58f0673f4f19c810a98e27d059ecc3f89c4ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|