Skip to main content

TTL Cache

PyPI - Version PyPI - Python Version CI codecov Docs

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.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ttl-cache-decorator 0.1.5
File Size Uploaded Provenance Actions
ttl_cache_decorator-0.1.5.tar.gz 56.1 kB With provenance Details for ttl_cache_decorator-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ttl-cache-decorator 0.1.5
File Interpreter ABI Platform Actions
ttl_cache_decorator-0.1.5-py3-none-any.whl Python 3 none any Details for ttl_cache_decorator-0.1.5-py3-none-any.whl

Total release size: 60.3 kB

Release files / ttl_cache_decorator-0.1.5.tar.gz

Download URL ttl_cache_decorator-0.1.5.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a587da492c20b3c0002bfa53adaf91d8c089596331039d1e2241c78b07d01ac2
BLAKE2b-256 checksum
How to use checksums
4d3fbc585918b624294a0f7868e67d20e27610d96fa9f4caf23441164a494480
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 8, 2026.

Transparency log

Release files / ttl_cache_decorator-0.1.5-py3-none-any.whl

Download URL ttl_cache_decorator-0.1.5-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2dbd573fc3eb5411192b7b84ba343547ae6f47d4bc2150fb85b7b6abaa6ee71a
BLAKE2b-256 checksum
How to use checksums
90bc60f6a3d860d9c9c0ec732e8132e905df990d0b51eaa38bc75f2d2c9a63a3
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 8, 2026.

Transparency log

Security for ttl-cache-decorator 0.1.5

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.

Select from 2 files

Attestation for ttl_cache_decorator-0.1.5.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 8, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page