Skip to content

SPR-12756: Local visibility for writes to caches with transactional decorators #1711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

williamhoyle
Copy link

This patch adds an alternative to the TransactionAwareCacheDecorator that addresses issues raised in SPR-12756 - it makes writes to decorated caches visible within the scope of the transaction.

It is intended to be minimally obtrusive. The current interface is not changed beyond adding a setCacheDecoratorFactory method to the TransactionAwareCacheManagerProxy to allow the strategy to be selected. The behaviour defaults to use the existing TransactionAwareCacheDecorator.

the TransactionAwareCacheDecorator that makes cache writes visible
within the scope of the writing transaction.

Issue: SPR-12756
@spring-projects spring-projects deleted a comment from githcheng Mar 1, 2018
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 24, 2019
@neiser
Copy link
Contributor

neiser commented Jan 5, 2021

@williamhoyle I found this PR while starting from this StackOverflow question asking why no CacheErrorHandler is called when transaction support is enabled for caching. This is IMHO a shortcoming if not a bug in Spring's way of "transaction-aware caching".

Now I found also this little project: https://github.com/ethlo/spring-tx-cache-decorator by @ethlo. Have you been aware of this project when you implemented this PR?

Do you think this PR could be extended to cover also the missing CacheErrorHandler call?

@rstoyanchev rstoyanchev added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Nov 10, 2021
@snicoll
Copy link
Member

snicoll commented Nov 16, 2021

Looking at the history of this issue (and #16574), it looks like that https://github.com/ethlo/spring-tx-cache-decorator could supersede this unless we decide we want to support that in the core framework and handle the additional complexity.

@neiser
Copy link
Contributor

neiser commented Nov 18, 2021

@snicoll I don't see directly how #16574 is related to this issue, but if transaction-aware caches are part of the Spring framework or not should really be decided as right now it is not consistently implemented. So either fix or remove 😀

@snicoll
Copy link
Member

snicoll commented Sep 14, 2023

Reviewing the history of this issue, I am not keen to bring that extra complexity and layering in the cache abstraction, so I am going to close this now. The discussion in #17353 provides additional context and justification. Thanks for the PR, in any case!

@snicoll snicoll closed this Sep 14, 2023
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants