aiomemoize

Memoize asyncio Python calls. Invalidation is manual/explicit for each set of arguments, although exceptions raised are not cached. This can be used for coroutines, and functions that return a promise.
Installation
pip install aiomemoize
Usage
For a coroutine whose arguments are hashable, you can create a memoized version by passing it to memoize. This returns a tuple of the memoized function, and a function to invalidate the cache on a per-item basis.
For example, the below
import asyncio
from aiomemoize import memoize
async def main():
memoized, invalidate = memoize(coro)
results = await asyncio.gather(*[
memoized('a'),
memoized('a'),
memoized('b'),
])
print(results)
invalidate('a')
results = await asyncio.gather(*[
memoized('a'),
memoized('a'),
memoized('b'),
])
print(results)
await memoized('a')
async def coro(value):
print('Inside coro', value)
await asyncio.sleep(1)
return value
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
will output
Inside coro a
Inside coro b
['a', 'a', 'b']
Inside coro a
['a', 'a', 'b']
Metadata
Release files for aiomemoize 0.0.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 | Provenance | Actions |
|---|---|---|---|---|
| aiomemoize-0.0.3.tar.gz | 2.0 kB | Without provenance | Details for aiomemoize-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiomemoize-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for aiomemoize-0.0.3-py3-none-any.whl |
Total release size: 5.0 kB
Release files / aiomemoize-0.0.3.tar.gz
| Download URL | aiomemoize-0.0.3.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d938faaeb7569bdb23d22636d5a3b9c0f23e70eee31c0636f94ba892a5adab7f
|
|
BLAKE2b-256 checksum How to use checksums |
bac063535cf9caa105841274e5aa93f1ad630786343e63adcde05d47a258c502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
|
Release files / aiomemoize-0.0.3-py3-none-any.whl
| Download URL | aiomemoize-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f43482f396765038af49b33d4a4915b24e403049fc777883ad25cb3e5ac38b5c
|
|
BLAKE2b-256 checksum How to use checksums |
a9f24de59365566e454aa880db8d2a6369349f8fa726d1d2c472a1309eb6ba70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
|
Security for aiomemoize 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.