Jimmer Cache And Transaction AOP #970
babyfish-ct
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Within the scope of MUATION transaction, all queries should be executed directly without Jimmer Cache.
For in-transaction triggers, ignoring cache mens to avoid the cache problem caused by rollback.
For binlog triggers, ignoring cache means to avoid the data sync problem cause by binlog delay.
Of course, the query operations automatically started by save command executes without cache, they are OK. However, what about query operations started by user?
Solution
Spring transaction have a
readOnly
flag, like@Transactional(readOnly = true)
, it allows users to mark whether a transaction is for query operations or mutation operation, this flag is not used by jimmer before.Jimmer also supports it own transaction propagation mechanism such as
sqlClient.transaction
and@Tx
(If jimmer-spring-starter is used, it wraps spring transaction, otherwise, provide a lightweight propagation mechanism like Spring), They should add thereadOnly
parameter too.Affect
Existing projects with jimmer cache need to review their
@Transactional
annotations because the behavior is adjusted.For
Quarkus
, can we implement the same approach? Input from someone familiar withQuarkus
would be helpful.Beta Was this translation helpful? Give feedback.
All reactions