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:
mailgun for expiringdict
Thomas Kemmer for https://github.com/tkem/cachetools
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
File details
Details for the file ttldict-0.2.3.tar.gz
.
File metadata
- Download URL: ttldict-0.2.3.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29724335d370a185ec4484c028e784d8c50a900ffcb6e2818b03e32c8ef2755e |
|
MD5 | ce58954e6d4f9fc4a58c75a4d619e88b |
|
BLAKE2b-256 | c3ccbd2ef5d1f0ed8020da9328f84baf99c70a1400ff411e229656289b2a0585 |