Closed
Description
Stas Volsky opened SPR-12756 and commented
As TransactionAwareCacheDecorator do actual cache operations on afterCommit phase there is incorrect behavior. Changes made in transaction are not visible to that transaction.
case:
- begin transaction
- call some method annotated with
@Cacheable
. - call another method annotated with
@CacheEvict
- call
@Cacheable
method one more time
expected behavior is that on step 4 cache will be empty inside current transaction and method will be executed one more time. but as changes will be applied only on transaction commit there are still cached results.
I suggest to make ThreadLocal map inside TransactionAwareCacheDecorator that will hold uncommited changes so it will be available to current transaction only. Or may be there is another solution.
1 votes, 5 watchers