TTL Cache
An LRU cache decorator with a time to live like functools.lru_cache, but entries expire after a configurable number of seconds.
Installation
pip install ttl-cache-decorator
Usage
from ttl_cache import ttl_lru_cache
@ttl_lru_cache(ttl=30)
def fetch_user(user_id: int) -> dict:
return {"id": user_id, "name": "Ada"}
fetch_user(1) # Calls the function
fetch_user(1) # Cache hit
# ... 30 seconds later ...
fetch_user(1) # Expired — calls the function again
License
ttl-cache-decorator is distributed under the terms of the MIT license.
Metadata
Release files for ttl-cache-decorator 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ttl_cache_decorator-0.1.7.tar.gz | 131.9 kB | With provenance | Details for ttl_cache_decorator-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ttl_cache_decorator-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for ttl_cache_decorator-0.1.7-py3-none-any.whl |
Total release size: 136.1 kB
Release files / ttl_cache_decorator-0.1.7.tar.gz
| Download URL | ttl_cache_decorator-0.1.7.tar.gz |
|---|---|
| Size | 131.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ac10cd661425ab32927bcc3bde886f973039b4681474a61079ec095925bbd3b
|
|
BLAKE2b-256 checksum How to use checksums |
6d437589364923b2fb439d29a2e5c492f50efb64649e217968f95c35f4c18b52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logRelease files / ttl_cache_decorator-0.1.7-py3-none-any.whl
| Download URL | ttl_cache_decorator-0.1.7-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e66d1335a7b4d33ff350ba614266131bb51fcc9941a8bbdac78e1ecc6d326ed
|
|
BLAKE2b-256 checksum How to use checksums |
cd622c29818ee74329f4d17cf7e9dc7a4fc8a5d68b9f70a2089058537d9c94d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logSecurity for ttl-cache-decorator 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ttl_cache_decorator-0.1.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.