Another dictionary with expiring keys.
Project description
ttldict2
Another dictionary with expiring keys.
Details
There are quire a few expiring/ttl dictionary libraries available. This one might be a better choice for you if:
- Only need support for Python 3.7+ or PyPy3
- Use it in a single/asyncio thread
- Work correctly regardless of system-clock adjustments
The implementation is a wrapper around the builtin dict. As a design choice the methods that are not wrapped with TTL logic are accessible and can be used with caution.
Install & usage
It is available on PyPI:
$ python -m pip install ttldict2
>>> import time
>>> import ttldict2
>>> d = ttldict2.TTLDict(ttl_seconds=1.0)
>>> d["a"] = 5
>>> d.get("a")
5
>>> time.sleep(1.1)
>>> d.get("a")
None
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ttldict2-0.1.1.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file ttldict2-0.1.1.tar.gz
.
File metadata
- Download URL: ttldict2-0.1.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87f6ccac7b7b8d879d469b0448d66b2f1e0c6497e018dceeead83edcba259d4d |
|
MD5 | 1682225c6f3cb482cc6a645509dec024 |
|
BLAKE2b-256 | 99bd119b47b0c481ed7af7f073a6a0d95b76757fa6b9c98c6d6dca34b6380146 |
File details
Details for the file ttldict2-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: ttldict2-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ce113a687c8c26e31883edebd4706406b2a7b1cf94ee318541fdfeba5478672 |
|
MD5 | 8c71c356eac62d5e63cbb11b9ddbef50 |
|
BLAKE2b-256 | 9990b5e174b7c974b08a354adc58a960c8ac6757171f667b8038e4e8b5f83b2a |