py-ttl-dict
Python Dictionary that supports expiring keys.
Usage
import ttldict
import time
my_dict = ttldict.TTLDict()
my_dict.set("key", "value," 2) # Expire Key after 2 seconds
print(my_dict.get("key")) # Prints "value"
time.sleep(3)
print(my_dict.get("key")) # Prints "None"
Install
$ pip install py-ttl-dict
Additional Usage
Convert to a Python Dict
import ttldict
import time
my_dict = ttldict.TTLDict()
my_dict.set("key", "value," 10)
python_dict = my_dict.as_dict()
print(python_dict)
Implementation Details
This implementation maintains a map of KV-pairs as well as a heap of expiry times. Insert is O(logn), Update TTL is O(n) and all accessors are O(klogn) where k is the number of entries that must be evicted.
Metadata
Release files for pyttldict 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyttldict-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pyttldict-1.0.0-py3-none-any.whl |
Release files / pyttldict-1.0.0-py3-none-any.whl
| Download URL | pyttldict-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10cf8626f6696ed489249fc0dc05e05246559ceca02fd2bae67c6fe799714333
|
|
BLAKE2b-256 checksum How to use checksums |
f217fe532bb6bed01ba2ae3542d90545fde9197af658b99c38672dc5972983e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Security for pyttldict 1.0.0
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.