@Cacheable key generator is called after invoking the cached method in case of a miss #31789
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: regression
A bug that is also a regression
Milestone
Affects: 6.1.1
We use
@Cacheable
on a few methods that have parameters of collection type and have a customKeyGenerator
implementation. In this key generator implementation we take into account each element of the input collections when creating the cache key.After upgrading from Spring Boot 3.1.5 to 3.2.0 we noticed that
CacheAspectSupport
has changed its behaviour such that, in case of a miss, cache key generation is called after the@Cacheable
method is invoked which means that the cache key might have changed if the collection elements were changed.Previous versions were calculating the cache key for put before invoking the
@Cacheable
method, thus making sure the method parameters were not changed by the invocation.The text was updated successfully, but these errors were encountered: