Skip to content

Upgrading cachetools 7 to 8

Breaking7.3.0 → 8.0.0Breaking7Platform1Changed1Other2

BreakingUpgrade verdict

7 breaking changes and a platform requirement change.

  • Old, already deprecated options of the cachedmethod decorator no longer work.
  • Passing cache=None to the cached decorator is no longer allowed.
  • If you use your own cache class with info=True, it must now implement __len__.
  • The internal cache info type is now a public class named CacheInfo.
Top 4 of 8 that need code or config changes

Python requirement changed in 8.0.0: >=3.10 → >=3.11.

Breaking7
Drops support for deprecated @cachedmethod features.
@cachedmethod
Drops support for @cached(cache=None).
@cached
Requires custom cache classes to support __len__ when used with info=True.
__len__info
Refactors _CacheInfo and makes it public as CacheInfo.
_CacheInfoCacheInfo
Returns callable objects instead of functions from @cached and cachetools.func decorators.
@cachedcachetools.func
Does not set cache_info to None on @cached wrappers when info is not set.
cache_info@cachedinfo
Raises TypeError for @cachedmethod descriptors assigned after class creation.
TypeError@cachedmethod__set_name__
Platform1
Drops Python 3.10 support.