pypi / flask-caching
flask-caching
What changed in flask-caching 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-25.
9 breaking14 new APIs and options2 behavior and defaults2 tooling9 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initflask-caching 236 changes
Breaking changes 9
View arguments named path or query_args are no longer treated as explicit make_cache_key() arguments of the same name.
The Jinja tag no longer propagates backend errors; if the cache is unavailable, it renders the block normally.
The default hash method changes from hashlib.md5 to hashlib.sha256, making earlier cache entries obsolete; configure hashlib.md5 to retain the old method.
Removes support for the deprecated lowercase backend names null, simple, filesystem, redis, redissentinel, rediscluster, uwsgi, memcached, gaememcached, saslmemcached, and spreadsaslmemcached.
Caches an HTTPException raised by the view and re-raises it on a cache hit; use response_filter to keep the exception out of the cache.
The minimum required cachelib version is 0.17.0.
Uses cachelib's delete_many behavior: nonexistent keys count as deleted, and with CACHE_IGNORE_ERRORS=False a RuntimeError is raised if a key could not be deleted.
forced_update callbacks are called once per decorated function call rather than during key creation and again before cache lookup.
Support for Python 3.10 is dropped.
New APIs and options 14
Adds a FileSystemCache configuration option to select a different hash function for cache keys.
Adds a configuration option to set the hash method used for cache keys created by @cached and @memoize.
Adds a configuration option to set the cachelib serializer used by the backend.
Signals are sent for cache hits and misses.
Cachelib backends can now be configured directly using a cachelib class path, such as cachelib.ValkeyCache.
Adds Cache.delete_cached() to support deleting views decorated with cached(query_string=True).
Adds an is_stale option called on a cache hit with the cached value to determine whether the cache is stale; it can be combined with forced_update.
Timeouts can now be specified with datetime.timedelta.
Adds the path argument to support deleting views decorated with cached(query_string=True).
Adds the query_args argument to support deleting views decorated with cached(query_string=True).
Adds pool_blocking to make MemcachedCache backends thread-safe.
Adds pool_size to make MemcachedCache backends thread-safe.
Adds an is_stale option called on a cache hit with the cached value to determine whether the cache is stale; it can be combined with forced_update.
Forwards kwargs to RedisCluster.from_url, allowing callers to pass arguments through.
Behavior and default changes 2
CACHE_IGNORE_ERRORS now applies to every backend instead of only SimpleCache and FileSystemCache.
SimpleCache is now thread-safe, using an RLock for all operations.
Tooling 2
Preserves the wrapped function's signature and exposes uncached, cache_timeout, and make_cache_key to type checkers.
Preserves the wrapped function's signature and exposes uncached, cache_timeout, make_cache_key, and delete_memoized to type checkers.
Fixes and other changes 9
For a bound method, delete_memoized now takes the instance from the method, so passing obj.method and arguments deletes that method's cache.
Includes key_prefix when building query-string cache keys.
Stops response_hit_indication=True from appending a new after_request function to the app on every request.
Fixes __caching_id__ so it can be used; @memoize no longer silently ignores it and runs the function uncached.
Fixes views returning iterators of strings so rendered templates are not returned as a list of JSON strings.
Fixes cache-key collisions between a falsy parameter default and None, which could return the wrong cached result.
Refreshes the memoize version key's timeout whenever an entry is written, using that entry's own timeout, to avoid invalidating the function's entire cache.
Fixes the CachedResponse.__init__ typing for mypy --strict.
Fixes memoize and cached TYPE_CHECKING annotations under Python 3.14.