We should add dedicated support for cache resets along with optimizations when using Redis. When using Redis solely for Caching (i.e. no sharing of the Redis database for non-cache operations), we could introduce functionality to issue FLUSHDB ASYNC instead of clearing each known cache individually. Pruning an entire database is a rather broad action so it should be provided only as opt-in variant to optimize within certain scenarios.
See also spring-projects/spring-framework#35845