Skip to main content

Dictionary with auto-expiring values for caching purposes

Project description

Python dictionary with key expiry time

OrderedTTLDict - behaves like an ordered dict you know. The methods items and values return a list of objects after purging expired objects. The method keys returns odict_keys as the parnet class, but it does so after purging expired keys. Python’s own OrderedDict and other dictionaries return a [dictionary views][1] whereas the methods here do not.

Testing

Use pytest to run the tests:

` make test `

Credits and Thanks:

and for Jyrki Muukkonen for ttldict published in https://github.com/jvtm/ttldict.

This library contains fixes for his TTLDict class and my own OrderedTTLDict.

Without all those this work would not have been possible.

[1]: https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ttldict-0.2.6.tar.gz (2.7 kB view details)

Uploaded Source

File details

Details for the file ttldict-0.2.6.tar.gz.

File metadata

  • Download URL: ttldict-0.2.6.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ttldict-0.2.6.tar.gz
Algorithm Hash digest
SHA256 09afd10a67ea8a6fb52855d3d6ea761086ff58085c90c8ea851f75fa70a68f77
MD5 2e1356e1ca2cdce68f00ef997e08ca04
BLAKE2b-256 ca7c168ec7eb6c8f0b8a3b9eb7416988c6e61fcc9de3ee420a8762cc8c38a8b3

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page