Provide some synchronization between @Cacheable and @CacheEvict annotated methods [SPR-9304] #13942
In many cases,
Now the resource is in state 2, the cache in state 1, but marked valid.
It would be great if there was some (optional) synchronization between the two cache annotations, that prevents such a race condition, if possible even in multi-node configurations.
5 votes, 14 watchers
The text was updated successfully, but these errors were encountered:
Oliver Drotbohm commented
Discussing this with Mario I think the crucial scenario is slightly different: It's rather that an invocation of an
Adib Saikali commented
From my perspective it is a pretty major issue because it means that using the
A user logs into my system and I need to pull back all the permissions they have, this is a very expensive operation requiring multiple db queries so I want to use
I have created a feature request for an
Stéphane Nicoll commented
We looked at this thoroughly and discussed internally what we could do at the abstraction level.
A general mechanism that would help synchronizing evict and put operations would probably ruin the performance. Besides, I haven't found a cache provider that offers such feature.
Do you guys have concrete proposals on how to implement this efficiently against specific cache providers? In particular, how to reduce the locking to just the specific cache entry as opposed to blocking access to the entire cache region?