Following up on #35840, we could consider generalizing the resetCaches() method from CaffeineCacheManager / ConcurrentMapCacheManager into the CacheManager interface. Just like the current provider-specific methods, it could have "throw away the cache content" semantics either through cache clearing or even actual dropping of caches.

A quick prototype shows that this method may have a straightforward default implementation that just iterates over all registered caches and calls Cache#clear() on them, whereas concrete providers can have a more optimized implementation (e.g. for JCache) or a more radical implementation that actually drops caches (like we have in CaffeineCacheManager / ConcurrentMapCacheManager already). CompositeCacheManager can apply the call to all of its delegates, making this useful for a broader cache reset attempt in an application as well.

Comment From: Parthiee

Hi @jhoeller ! This enhancement looks quite interesting to me. Do you mind assigning it to me?

Comment From: jhoeller

@Parthiee I've got this locally prepared already - however, we don't have a branch toward 7.1 yet, so I cannot commit it yet.

So I intend to handle this myself once we branch. Thanks for volunteering, in any case!

Comment From: jhoeller

On review, we are bringing this into 7.0.2 right away, giving the ecosystem a chance to improve on the default resetCaches() implementation in the CacheManager interface from here.