unstale

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 init

@unstale/cli 0.2.6 on npm

flask-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.

    2.5.1release notes

  • The Jinja tag no longer propagates backend errors; if the cache is unavailable, it renders the block normally.

    2.5.0release notes

  • The default hash method changes from hashlib.md5 to hashlib.sha256, making earlier cache entries obsolete; configure hashlib.md5 to retain the old method.

    2.5.0release notes

  • Removes support for the deprecated lowercase backend names null, simple, filesystem, redis, redissentinel, rediscluster, uwsgi, memcached, gaememcached, saslmemcached, and spreadsaslmemcached.

    2.5.0release notes

  • 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.

    2.5.0release notes

  • The minimum required cachelib version is 0.17.0.

    2.5.0release notes

  • 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.

    2.5.0release notes

  • forced_update callbacks are called once per decorated function call rather than during key creation and again before cache lookup.

    2.5.0release notes

  • Support for Python 3.10 is dropped.

    2.5.0release notes

New APIs and options 14

  • Adds a FileSystemCache configuration option to select a different hash function for cache keys.

    2.5.0release notes

  • Adds a configuration option to set the hash method used for cache keys created by @cached and @memoize.

    2.5.0release notes

  • Adds a configuration option to set the cachelib serializer used by the backend.

    2.5.0release notes

  • Signals are sent for cache hits and misses.

    2.5.0release notes

  • Cachelib backends can now be configured directly using a cachelib class path, such as cachelib.ValkeyCache.

    2.5.0release notes

  • Adds Cache.delete_cached() to support deleting views decorated with cached(query_string=True).

    2.5.0release notes

  • 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.

    2.5.0release notes

  • Timeouts can now be specified with datetime.timedelta.

    2.5.0release notes

  • Adds the path argument to support deleting views decorated with cached(query_string=True).

    2.5.0release notes

  • Adds the query_args argument to support deleting views decorated with cached(query_string=True).

    2.5.0release notes

  • Adds pool_blocking to make MemcachedCache backends thread-safe.

    2.5.0release notes

  • Adds pool_size to make MemcachedCache backends thread-safe.

    2.5.0release notes

  • 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.

    2.5.0release notes

  • Forwards kwargs to RedisCluster.from_url, allowing callers to pass arguments through.

    2.4.1release notes

Behavior and default changes 2

  • CACHE_IGNORE_ERRORS now applies to every backend instead of only SimpleCache and FileSystemCache.

    2.5.0release notes

  • SimpleCache is now thread-safe, using an RLock for all operations.

    2.5.0release notes

Tooling 2

  • Preserves the wrapped function's signature and exposes uncached, cache_timeout, and make_cache_key to type checkers.

    2.5.0release notes

  • Preserves the wrapped function's signature and exposes uncached, cache_timeout, make_cache_key, and delete_memoized to type checkers.

    2.5.0release notes

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.

    2.5.0release notes

  • Includes key_prefix when building query-string cache keys.

    2.5.0release notes

  • Stops response_hit_indication=True from appending a new after_request function to the app on every request.

    2.5.0release notes

  • Fixes __caching_id__ so it can be used; @memoize no longer silently ignores it and runs the function uncached.

    2.5.0release notes

  • Fixes views returning iterators of strings so rendered templates are not returned as a list of JSON strings.

    2.5.0release notes

  • Fixes cache-key collisions between a falsy parameter default and None, which could return the wrong cached result.

    2.5.0release notes

  • 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.

    2.5.0release notes

  • Fixes the CachedResponse.__init__ typing for mypy --strict.

    2.4.1release notes

  • Fixes memoize and cached TYPE_CHECKING annotations under Python 3.14.

    2.4.1release notes