# TTL-Dictionary
A basic yet useful module made to streamline projects that need a basic TTL system that also is compatible with most serializers.
```python
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}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/notaussie/ttldict",
"name": "ttldictionary",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "ttl",
"author": "NotAussie",
"author_email": "NotAussie@duck.com",
"download_url": "https://files.pythonhosted.org/packages/0a/5f/6c02a6bb45079b761d7da73f0a66f6892bc62361e64f502ed756af455f2b/ttldictionary-0.1.0.tar.gz",
"platform": null,
"description": "# TTL-Dictionary\n\nA basic yet useful module made to streamline projects that need a basic TTL system that also is compatible with most serializers.\n\n```python\nttl_dict = TTLDict()\nttl_dict.set('a', 1, ttl=5) # Key 'a' will expire in 5 seconds\nprint(ttl_dict.get('a')) # Output: 1\ntime.sleep(6)\nprint(ttl_dict.get('a')) # Output: None (expired)\n\n# Serialize to JSON\nttl_dict.set('b', 2, ttl=10)\njson_data = json.dumps(ttl_dict) # Output: {\"b\": 2}\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": "Basic TTL system for Python dictionaries.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/notaussie/ttldict",
"Repository": "https://github.com/notaussie/ttldict"
},
"split_keywords": [
"ttl"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca7501324edb94829eb3c351633750ff8e531c554345512a24403d8560b1427e",
"md5": "bf5a7b945eb5f64e244388660eb87648",
"sha256": "32f353123a3513e46af118175136ef0089134d9ece8a0c1c0955709676ee1da4"
},
"downloads": -1,
"filename": "ttldictionary-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bf5a7b945eb5f64e244388660eb87648",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 3955,
"upload_time": "2024-10-17T14:24:17",
"upload_time_iso_8601": "2024-10-17T14:24:17.375076Z",
"url": "https://files.pythonhosted.org/packages/ca/75/01324edb94829eb3c351633750ff8e531c554345512a24403d8560b1427e/ttldictionary-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0a5f6c02a6bb45079b761d7da73f0a66f6892bc62361e64f502ed756af455f2b",
"md5": "409bd01d65663da1823576f2e6eda4a9",
"sha256": "ac98b90bf38ff0827e5543725d9cb4545f67aa9537d7f7ac6baa1593e8f6ff57"
},
"downloads": -1,
"filename": "ttldictionary-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "409bd01d65663da1823576f2e6eda4a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 3381,
"upload_time": "2024-10-17T14:24:18",
"upload_time_iso_8601": "2024-10-17T14:24:18.616421Z",
"url": "https://files.pythonhosted.org/packages/0a/5f/6c02a6bb45079b761d7da73f0a66f6892bc62361e64f502ed756af455f2b/ttldictionary-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-17 14:24:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "notaussie",
"github_project": "ttldict",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ttldictionary"
}