Basic TTL system for Python dictionaries.
Project description
TTL-Dictionary
A basic yet useful module made to streamline projects that need a basic TTL system that also is compatible with most serializers.
ttl_dict = TTLDict()
ttl_dict.set('a', 1, ttl=5) # Key 'a' will expire in 5 seconds
print(ttl_dict.get('a')) # Output: 1
time.sleep(6)
print(ttl_dict.get('a')) # Output: None (expired)
# Serialize to JSON
ttl_dict.set('b', 2, ttl=10)
json_data = json.dumps(ttl_dict) # Output: {"b": 2}
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
ttldictionary-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ttldictionary-0.1.0.tar.gz.
File metadata
- Download URL: ttldictionary-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac98b90bf38ff0827e5543725d9cb4545f67aa9537d7f7ac6baa1593e8f6ff57
|
|
| MD5 |
409bd01d65663da1823576f2e6eda4a9
|
|
| BLAKE2b-256 |
0a5f6c02a6bb45079b761d7da73f0a66f6892bc62361e64f502ed756af455f2b
|
File details
Details for the file ttldictionary-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ttldictionary-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.10.11 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32f353123a3513e46af118175136ef0089134d9ece8a0c1c0955709676ee1da4
|
|
| MD5 |
bf5a7b945eb5f64e244388660eb87648
|
|
| BLAKE2b-256 |
ca7501324edb94829eb3c351633750ff8e531c554345512a24403d8560b1427e
|