Skip to main content

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

Metadata

Release files for ttldict2 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ttldict2 0.1.1
File Size Uploaded
ttldict2-0.1.1.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ttldict2 0.1.1
File Interpreter ABI Platform
ttldict2-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / ttldict2-0.1.1.tar.gz

Download URL ttldict2-0.1.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
87f6ccac7b7b8d879d469b0448d66b2f1e0c6497e018dceeead83edcba259d4d
BLAKE2b-256 checksum
How to use checksums
99bd119b47b0c481ed7af7f073a6a0d95b76757fa6b9c98c6d6dca34b6380146
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ttldict2-0.1.1-py3-none-any.whl

Download URL ttldict2-0.1.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ce113a687c8c26e31883edebd4706406b2a7b1cf94ee318541fdfeba5478672
BLAKE2b-256 checksum
How to use checksums
9990b5e174b7c974b08a354adc58a960c8ac6757171f667b8038e4e8b5f83b2a
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page