{"id":23387,"library":"cachettl","title":"cachettl","description":"cachettl is an elegant LRU TTL cache decorator for Python, supporting both synchronous and asyncio functions. Version 1.0.4 (latest) requires Python >=3.7. Provides cache_info(), cache_clear(), and a remainingttl property. Development appears stable with infrequent releases.","status":"active","version":"1.0.4","language":"python","source_language":"en","source_url":"https://github.com/rabuchaim/cachettl","tags":["cache","lru","ttl","asyncio","decorator"],"install":[{"cmd":"pip install cachettl","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The decorator is named cachettl (lowercase).","symbol":"cachettl","correct":"from cachettl import cachettl"}],"quickstart":{"code":"from cachettl import cachettl\nimport time\n\n@cachettl(maxsize=128, ttl=60)\ndef expensive_function(n):\n    return n * n\n\nprint(expensive_function(5))  # Computes and caches\nprint(expensive_function(5))  # Returns cached result\nprint(expensive_function.cache_info())  # e.g., hits=1, misses=1\nprint(expensive_function.remainingttl())  # seconds left\ntime.sleep(61)\nprint(expensive_function(5))  # Recomputes after TTL expiry\n","lang":"python","description":"Basic usage of cachettl decorator with maxsize and ttl."},"warnings":[{"fix":"Use 'from cachettl import cachettl' and decorate with @cachettl(...).","message":"The decorator name is cachettl (all lowercase), not cache_ttl or CacheTTL. Importing from cachettl import cachettl is required.","severity":"gotcha","affected_versions":"all"},{"fix":"Use @cachettl(maxsize=128, ttl=60) only. Do not pass other unexpected kwargs.","message":"The decorator does not support keyword-only arguments like 'cache' or 'timeout'. Only positional parameters: maxsize, ttl, and maxage.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install cachettl' to install the package.","cause":"Package not installed or installed under a different name.","error":"ModuleNotFoundError: No module named 'cachettl'"},{"fix":"Replace 'timeout' with 'ttl' in the decorator call.","cause":"Using a non-existent keyword argument 'timeout' instead of 'ttl'.","error":"TypeError: __init__() got an unexpected keyword argument 'timeout'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}