NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #127 most downloaded on PyPI
Extensible memoizing collections and decorators
Latest stable
8.0.2
Last release 3 days ago
19 Nov 2026
Release timing varies
gaps range from 9 days to 2 months
Nearly every release is documented
notes for 59 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
13 years old
92 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
Fix deep-copying TTLCache and TLRUCache instances whose timer defines __deepcopy__.
Fix deep-copying TTLCache and TLRUCache instances whose timer defines __deepcopy__.
Fix updating TTLCache and TLRUCache items while iterating, which skipped or repeated keys.
Minor code improvements.
Fix copying and deep-copying @cached wrappers of callables without a __qualname__, e.g. functools.partial objects (broken since v8.0.0).
Fix copying and deep-copying @cached wrappers of callables without a __qualname__, e.g. functools.partial objects (broken since v8.0.0).
Fix deep-copying and pickling LFUCache instances with many different use counts (broken since v6.1.0).
Properly support shallow copies of caches, including subclasses with additional attributes.
Minor LRUCache performance improvements.
Minor @cachedmethod error handling improvements.
Minor documentation improvements.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Drop Python 3.10 support (breaking change).
Drop Python 3.10 support (breaking change).
Drop support for deprecated @cachedmethod features (breaking change).
Drop support for @cached(cache=None) (breaking change).
Require custom cache classes to support __len__ when used with info=True (breaking change).
Refactor _CacheInfo and make it public as CacheInfo (potentially breaking change).
Return callable objects instead of functions from @cached and the cachetools.func decorators (potentially breaking change).
Do not set cache_info to None on @cached wrappers if info is not set (potentially breaking change).
Raise TypeError for @cachedmethod descriptors assigned after class creation, i.e. without __set_name__ being called (potentially breaking change).
Various performance improvements.
Various documentation improvements.
Various test improvements.
Nothing published for this version
Properly support shallow copies of caches, including subclasses with additional attributes (broken since v7.3.1).
Properly support shallow copies of caches, including subclasses with additional attributes (broken since v7.3.1).
Fix deep-copying and pickling LFUCache instances with many different use counts (broken since v6.1.0).
Fix deep-copying and pickling LFUCache instances with many different use counts (broken since v6.1.0).
Fix shallow copies of caches sharing internal state with the original.
Minor documentation improvements.
Use OrderedDict for defined and faster LFUCache eviction.
Use OrderedDict for defined and faster LFUCache eviction.
Various unit test improvements.
Minor type stub improvements.
Minor documentation improvements.
Fix type stubs for TTLCache and TLRUCache with default timer.
Fix type stubs for TTLCache and TLRUCache with default timer.
Minor documentation and unit test improvements.
Various performance improvements.
Various performance improvements.
Minor unit test improvements.
Various performance improvements.
Various performance improvements.
Fix @cachedmethod with condition for decorated methods taking a pending keyword argument (broken since v7.0.0).
Fix @cachedmethod with condition for decorated methods taking a pending keyword argument (broken since v7.0.0).
Fix pickling and deep-copying of instances using @cachedmethod (broken since v7.0.0).
Fix calling @cachedmethod decorated methods through the class with the receiver (self) passed as a keyword argument (broken since v7.2.4).
Various documentation improvements.
Restore autospec calls to @cachedmethod decorated methods.
Restore autospec calls to @cachedmethod decorated methods.
Improve branch coverage of unit tests.
Minor type stub improvements.
Fix @cached decorator stacking behavior.
Fix @cached decorator stacking behavior.
Minor type stub improvements.
Fix @cachedmethod for subclasses that override a decorated method and call the base class implementation via super().
Fix @cachedmethod for subclasses that override a decorated method and call the base class implementation via super().
Restore class access to instance methods decorated with @cachedmethod.
Improve TTLCache robustness when calculating expiration time fails.
Various unit test improvements.
Improve error handling for RRCache.popitem() when the cache is empty.
Improve error handling for RRCache.popitem() when the cache is empty.
Minor style and documentation improvements.
Update CI environment.
Deprecate use of cache=None to suppress caching with the @cached decorator.
Deprecate use of cache=None to suppress caching with the @cached decorator.
Add support for Python 3.15.
Minor test improvements.
Minor documentation updates.
Reject negative maxsize in Cache.__init__.
Reject negative maxsize in Cache.__init__.
Improve Cache.__setitem__ behavior when replacing an existing cache item with a larger value.
Improve Cache.__setitem__ behavior when replacing an existing cache item with a larger value.
Update CI environment.
Minor style improvements to keep ruff happy.
Minor style improvements to keep ruff happy.
Fix TLRUCache silently keeping stale values on expired overwrites.
Fix TLRUCache silently keeping stale values on expired overwrites.
Reject negative cache item getsizeof values.
Update build environment.
- Minor unit test improvements. - Update build environment.
Minor unit test improvements.
Update build environment.
- Minor type stub improvements. - Update build environment.
Minor type stub improvements.
Update build environment.
Minor documentation improvements.
Minor type stub improvements.
Minor documentation improvements.
Modernize build environment.
Various type stub improvements.
Various type stub improvements.
Add type stubs based on the work of the good people at typeshed __.
Add type stubs based on the work of the good people at typeshed.
Update unit tests.
- Minor code improvements. - Update project URLs. - Update CI environment.
Minor code improvements.
Update project URLs.
Update CI environment.
Minor @cachedmethod performance improvements.
Minor @cachedmethod performance improvements.
Fix and properly document @cachedmethod.cache_key behavior.
Fix and properly document @cachedmethod.cache_key behavior.
Minor documentation improvements.
Fix DeprecationWarning when creating an autospec mock with @cachedmethod decorations.
Fix DeprecationWarning when creating an autospec mock with @cachedmethod decorations.
Provide more efficient clear() implementation for all supported Cache classes (courtesy Josep Pon Farreny).
Provide more efficient clear() implementation for all supported Cache classes (courtesy Josep Pon Farreny).
- Various test improvements. - Update Copilot Instructions.
Various test improvements.
Update Copilot Instructions.
Require Python 3.10 or later (breaking change).
Require Python 3.10 or later (breaking change).
Drop support for passing info as fourth positional parameter to @cached (breaking change).
Drop support for cache(self) returning None with @cachedmethod (breaking change).
Convert the @cachedmethod wrappers to descriptors, deprecating its use with class methods and instances that do not provide a mutable __dict__ attribute (potentially breaking change).
Convert the previously undocumented @cachedmethod attributes (cache, cache_lock, etc.) to properties for instance methods, providing official support and documentation (potentially breaking change).
Add an optional info parameter to the @cachedmethod decorator for reporting per-instance cache statistics. Note that this requires the instance's __dict__ attribute to be a mutable mapping.
Minor documentation improvements.
Improve typedkey performance.
Minor documentation improvements.
Minor testing improvements.
Minor code readability improvements.
Improve documentation regarding @cachedmethod with lock parameter.
Improve documentation regarding @cachedmethod with lock parameter.
Add test cases for cache stampede scenarios.
Update CI environment.
Fix license information displayed on PyPI by using an updated version of twine for uploading.
Fix license information displayed on PyPI by using an updated version of twine for uploading.
Improve documentation regarding @cachedmethod with condition parameter.
Improve documentation regarding @cachedmethod with condition parameter.
Minor style and readability improvements.
Modernize build environment.
Update CI environment.
Minor improvements from GitHub Copilot code review.
Minor improvements from GitHub Copilot code review.
Improve documentation.
- Add support for Python 3.14. - Improve documentation. - Update CI environment.
Add support for Python 3.14.
Improve documentation.
Update CI environment.
Improve general RRCache performance by storing cache keys in an additional sequence container. Note that this will increase memory consumption.
Improve general RRCache performance by storing cache keys in an additional sequence container. Note that this will increase memory consumption.
Add more unit tests.
Improve LFUCache insertion performance by switching to an implementation based on the cacheing _ library.
Improve LFUCache insertion performance by switching to an implementation based on the cacheing library.
Update CI environment.
Require Python 3.9 or later (breaking change).
Require Python 3.9 or later (breaking change).
Remove MRUCache and the @func.mru_cache decorator (breaking change).
Add an optional condition parameter to the @cached and @cachedmethod decorators, which, when used with a threading.Condition instance, should improve cache stampede issues in massively parallel environments. Note that this will inflict some performance penalty, and therefore has to be enabled explicitly.
Convert the cachetools.func decorators to use a threading.Condition instance to deal with cache stampede issues. Note that this may result in a noticeable performance degradation, depending on your actual use case.
Deprecate support for cache(self) returning None to suppress caching with the @cachedmethod decorator.
Improve documentation.
Update CI environment.
Reduce number of @cached lock/unlock operations.
Reduce number of @cached lock/unlock operations.
Improve documentation.
Update CI environment.
Add documentation regarding caching of exceptions.
Add documentation regarding caching of exceptions.
Officially support Python 3.13.
Update CI environment.
TTLCache.expire() returns iterable of expired (key, value) pairs.
TTLCache.expire() returns iterable of expired (key, value) pairs.
TLRUCache.expire() returns iterable of expired (key, value) pairs.
Documentation improvements.
Update CI environment.
Deprecate @func.mru_cache decorator.
Add the keys.typedmethodkey decorator.
Deprecate MRUCache class.
Deprecate @func.mru_cache decorator.
Update CI environment.
- Documentation improvements. - Update CI environment.
Documentation improvements.
Update CI environment.
Various documentation improvements.
Add support for Python 3.12.
Various documentation improvements.
- Depend on Python >= 3.7.
Depend on Python >= 3.7.
Add cache_info() function to @cached decorator.
Add cache_info() function to @cached decorator.
Correct version information in RTD documentation.
Add support for Python 3.11.
Correct version information in RTD documentation.
badges/shields: Change to GitHub workflow badge routes.
Add cachetools.keys.methodkey().
Add cachetools.keys.methodkey().
Add cache_clear() function to decorators.
Add src directory to sys.path for Sphinx autodoc.
Modernize func wrappers.
Add cache decorator parameters as wrapper function attributes.
Add cache decorator parameters as wrapper function attributes.
Require Python 3.7 or later (breaking change).
Require Python 3.7 or later (breaking change).
Remove deprecated submodules (breaking change).
The cache, fifo, lfu, lru, mru, rr and ttl submodules have been deleted. Therefore, statements like
from cachetools.ttl import TTLCache
will no longer work. Use
from cachetools import TTLCache
instead.
Pass self to @cachedmethod key function (breaking change).
The key function passed to the @cachedmethod decorator is now called as key(self, *args, **kwargs).
The default key function has been changed to ignore its first argument, so this should only affect applications using custom key functions with the @cachedmethod decorator.
Change exact time of expiration in TTLCache (breaking change).
TTLCache items now get expired if their expiration time is less than or equal to timer(). For applications using the default timer(), this should be barely noticeable, but it may affect the use of custom timers with larger tick intervals. Note that this also implies that a TTLCache with ttl=0 can no longer hold any items, since they will expire immediately.
Change Cache.__repr__() format (breaking change).
String representations of cache instances now use a more compact and efficient format, e.g.
LRUCache({1: 1, 2: 2}, maxsize=10, currsize=2)
Add TLRU cache implementation.
Documentation improvements.
Add submodule shims for backward compatibility.
Add submodule shims for backward compatibility.
Add documentation and tests for using TTLCache with datetime.
Add documentation and tests for using TTLCache with datetime.
Link to typeshed typing stubs.
Flatten package file hierarchy.
- Update build environment. - Remove Python 2 remnants. - Format code with Black.
Update build environment.
Remove Python 2 remnants.
Format code with Black.
Handle __missing__() not storing cache items.
Handle __missing__() not storing cache items.
Clean up __missing__() example.
Improve behavior of decorators in case of race conditions.
Add FIFO cache implementation.
Add MRU cache implementation.
Improve behavior of decorators in case of race conditions.
Improve documentation regarding mutability of caches values and use of key functions with decorators.
Officially support Python 3.9.
Improve popitem() exception context handling.
Improve popitem() exception context handling.
Replace float('inf') with math.inf.
Improve "envkey" documentation example.
Support user_function with cachetools.func decorators (Python 3.8 compatibility).
Support user_function with cachetools.func decorators (Python 3.8 compatibility).
Support cache_parameters() with cachetools.func decorators (Python 3.9 compatibility).
One column per quarter.