TimerDict
This package provides a simple dictionary-like class, which drops items after a set amount of time.
from datetime import timedelta
from typing import Union
# When creating a TimerDict specify for how long items should live for:
my_dict = TimerDict(default_duration=timedelta(minutes=5))
# Then add items like you would to any dictionary
my_dict["foo"] = "bar"
# Or use the `put` method if you want to explicitly set the duration for a key
my_dict.put('foo', 'bar', timedelta(seconds=10))
# Getting items also works just like you'd would expect
print(my_dict['foo'])
Implementation Details
Internally, the dict keeps a queue of all items and when they should be removed.
The items are then purged whenever control flow passes to the dictionary, such
as when adding or getting an item. There is no separate thread or async task
running in the background.
Metadata
Release files for timer-dict 1.0.0
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 |
|---|---|---|---|---|
| timer_dict-1.0.0.tar.gz | 3.1 kB | Without provenance | Details for timer_dict-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| timer_dict-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for timer_dict-1.0.0-py3-none-any.whl |
Total release size: 6.7 kB
Release files / timer_dict-1.0.0.tar.gz
| Download URL | timer_dict-1.0.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d53ae6d42bf722abdb9c061c6beb8a9d1ca9485e7c82c39decd43f64017e0215
|
|
BLAKE2b-256 checksum How to use checksums |
6d4b1d1a0720fc448f789d41297b6e063fc38e33f4df227f4a36436b6653c9e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.9 Linux/6.2.5-arch1-1
|
Release files / timer_dict-1.0.0-py3-none-any.whl
| Download URL | timer_dict-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90ba4f310c377a6813daecfa6fd3d7d4acdda45527d1b332a413a8bc0c0e04e6
|
|
BLAKE2b-256 checksum How to use checksums |
16bd8f6139e75a82f1de7e6e54f535f109c2b4e63a20cedbff15e816d7bee0dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.9 Linux/6.2.5-arch1-1
|
Security for timer-dict 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.