cachettl
cachettl is an elegant LRU TTL cache decorator that also works with asyncio. It has the cache_info(), cache_clear() methods and access to the remainingttl property.
Decision gist · record as of 2026-08-14
Yes, with conditions. The package is stable, MIT-licensed, and has no known vulnerabilities. It fills a genuine niche: simple TTL caching with asyncio support and cache introspection. However, maintenance is dormant (last commit July 2024, no updates since), so adopt it only if you accept that bug fixes or feature requests may not be addressed. For production use in a team, verify that the dormant status aligns with your risk tolerance.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.7 or later; arguments to cached functions must be hashable.
- Installation friction is high: the package is a pure-Python tarball with no runtime dependencies, but maintenance is dormant—last commit was 2024-07-07 and no activity since.
- The codebase is stable (Production/Stable classifier) but receives no ongoing updates.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you may use, modify, and distribute this package freely with minimal restrictions, provided you include the license notice.
last release 2024-07-06 (769 days) · last repo commit 2024-07-07 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 74,399 downloads/mo, #14,844 on PyPI
Alternatives
Verify before relying
from cachettl import cachettl
import time
@cachettl(ttl=60, maxsize=None, typed=False)
def my_function(arg):
return f"result for {arg}"
result = my_function("test")
info = my_function.cache_info() # Returns (hits, misses, maxsize, currsize, remainingttl)
my_function.cache_clear()- Whether the package handles cache expiration correctly under high concurrency or with very short TTLs.
- Performance characteristics compared to functools.lru_cache or other third-party TTL cache libraries.
- Whether the remainingttl property accounts for clock adjustments or system time changes.
What it is and what it does
cachettl is a decorator library that adds time-limited caching to Python functions. It wraps both synchronous and asynchronous functions with an LRU (Least Recently Used) cache that automatically expires entries after a configurable TTL (time-to-live) in seconds. The cache can optionally be bounded by size, and supports type-aware argument caching so that f(3) and f(3.0) are cached separately if desired.
The package provides two decorator variants: the full @cachettl and @async_cachettl decorators expose cache_info() (which returns hits, misses, maxsize, currsize, and remainingttl) and cache_clear() methods; the minimal @cachettl_min and @async_cachettl_min variants omit these introspection features. It is pure Python with no external dependencies, making it lightweight to install and use in any Python 3.7+ environment.
Use it for
- Cache expensive function results for a fixed duration to reduce redundant computation in web services or data processing pipelines.
- Monitor cache hit/miss ratios and TTL expiration timing via cache_info() to optimize caching parameters.
- Add TTL caching to async I/O-bound functions (e.g., API calls, database queries) without blocking.
- Implement type-aware caching for functions that accept arguments of different types and should treat them as distinct cache keys.
- Replace functools.lru_cache when you need automatic expiration rather than unbounded or LRU-only eviction.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
The package is stable, MIT-licensed, and has no known vulnerabilities. It fills a genuine niche: simple TTL caching with asyncio support and cache introspection. However, maintenance is dormant (last commit July 2024, no updates since), so adopt it only if you accept that bug fixes or feature requests may not be addressed. For production use in a team, verify that the dormant status aligns with your risk tolerance.
Install
cachettl on PyPI
Before you install
Installation friction is high: the package is a pure-Python tarball with no runtime dependencies, but maintenance is dormant—last commit was 2024-07-07 and no activity since. The codebase is stable (Production/Stable classifier) but receives no ongoing updates.
Requires Python 3.7 or later; arguments to cached functions must be hashable.
License in practice
MIT license is permissive; you may use, modify, and distribute this package freely with minimal restrictions, provided you include the license notice.
Quickstart
from cachettl import cachettl
import time
@cachettl(ttl=60, maxsize=None, typed=False)
def my_function(arg):
return f"result for {arg}"
result = my_function("test")
info = my_function.cache_info() # Returns (hits, misses, maxsize, currsize, remainingttl)
my_function.cache_clear()
Verify before relying
- Whether the package handles cache expiration correctly under high concurrency or with very short TTLs.
- Performance characteristics compared to functools.lru_cache or other third-party TTL cache libraries.
- Whether the remainingttl property accounts for clock adjustments or system time changes.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Dormant 769 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,399 / month, #14,844 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: Windows :: Windows 10Operating System :: Microsoft :: Windows :: Windows 11Operating System :: POSIXOperating System :: POSIX :: BSDOperating System :: POSIX :: BSD :: FreeBSDOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Utilities |
Evidence: cachettl-1.0.4.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “lru ttl cache decorator”
- cachettlcachettl provides LRU TTL cache decorators for both synchronous and…
- async-lruAn LRU cache decorator for async functions that deduplicates…
- cacheoutCacheout provides in-memory caching with multiple eviction strategies…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also async-lru · memoization · onecache · cachetools-async · async-cache · asyncache · cachetools · pylru · expiring-dict · vercel-cache