py-expiring-dict
Python dict with TTL support for auto-expiring caches
Install
pip install expiring-dict
Usage
Class Level TTL
from time import sleep
from expiring_dict import ExpiringDict
cache = ExpiringDict(1) # Keys will exist for 1 second
cache["abc123"] = "some value"
assert "abc123" in cache
sleep(1)
assert "abc123" not in cache
Key Level TTL
from time import sleep
from expiring_dict import ExpiringDict
cache = ExpiringDict() # No TTL set, keys set via [] will not expire
cache["abc"] = "persistent"
cache.ttl("123", "expired", 1) # This will expire after 1 second
assert "abc" in cache
assert "123" in cache
sleep(1)
assert "abc" in cache
assert "123" not in cache
Metadata
Release files for expiring-dict 1.1.2
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 |
|---|---|---|---|---|
| expiring_dict-1.1.2.tar.gz | 3.7 kB | Without provenance | Details for expiring_dict-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| expiring_dict-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for expiring_dict-1.1.2-py3-none-any.whl |
Total release size: 7.5 kB
Release files / expiring_dict-1.1.2.tar.gz
| Download URL | expiring_dict-1.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca8cb802304eae5b33a23ec4c19019b610adfda50cbc4c9bfa3ad5c2cd387631
|
|
BLAKE2b-256 checksum How to use checksums |
2f127e71bb6aaf95e1e27994bfb87d0b8e73b0e4cfcfa64b611abd5088c7ac99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.20
|
Release files / expiring_dict-1.1.2-py3-none-any.whl
| Download URL | expiring_dict-1.1.2-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe5ac10c1e985edfba5f90666cf52ad295a93b4521f20dabcd769a9372d70905
|
|
BLAKE2b-256 checksum How to use checksums |
15f7be98b00881a13982675626ed20323ce276358b0d6bf9b370b030c6f6b22f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.20
|
Security for expiring-dict 1.1.2
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.