缓存和事务一起使用的问题 #2140
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#2140
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
在开启缓存的时候,在session中删除数据,commit后发现之前缓存的数据依然可以查询到,数据表中已经删除,下面是我的代码
打印输出为:
&{6 test}
insession &{6 test}
before delete &{6 update}
after delete &{6 update}
关闭缓存之后的输出为:
get &{7 test}
insession &{7 test}
before delete &{7 update}
开启日志后
[xorm] [info] 2022/04/29 09:45:53.193853 [SQL] SELECT
TABLE_NAME
,ENGINE
,AUTO_INCREMENT
,TABLE_COMMENT
fromINFORMATION_SCHEMA
.TABLES
WHERETABLE_SCHEMA
=? AND (ENGINE
='MyISAM' ORENGINE
= 'InnoDB' ORENGINE
= 'TokuDB') [xgames] - 921.944µs[xorm] [info] 2022/04/29 09:45:53.194580 [SQL] SELECT
COLUMN_NAME
,IS_NULLABLE
,COLUMN_DEFAULT
,COLUMN_TYPE
,COLUMN_KEY
,EXTRA
,COLUMN_COMMENT
, (INSTR(VERSION(), 'maria') > 0 && (SUBSTRING_INDEX(VERSION(), '.', 1) > 10 || (SUBSTRING_INDEX(VERSION(), '.', 1) = 10 && (SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) > 2 || (SUBSTRING_INDEX(SUBSTRING(VERSION(), 4), '.', 1) = 2 && SUBSTRING_INDEX(SUBSTRING(VERSION(), 6), '-', 1) >= 7))))) AS NEEDS_QUOTE FROMINFORMATION_SCHEMA
.COLUMNS
WHERETABLE_SCHEMA
= ? ANDTABLE_NAME
= ? ORDER BYCOLUMNS
.ORDINAL_POSITION [xgames bw_testtable] - 576.489µs[xorm] [info] 2022/04/29 09:45:53.194890 [SQL] SELECT
INDEX_NAME
,NON_UNIQUE
,COLUMN_NAME
FROMINFORMATION_SCHEMA
.STATISTICS
WHERETABLE_SCHEMA
= ? ANDTABLE_NAME
= ? [xgames bw_testtable] - 227.154µs[xorm] [info] 2022/04/29 09:45:53.199220 [SQL] INSERT INTO
bw_testtable
(name
) VALUES (?) [created] - 3.611744ms[xorm] [debug] 2022/04/29 09:45:53.199248 [cache] clear SQL: bw_testtable
[xorm] [debug] 2022/04/29 09:45:53.199322 [cache] Get SQL: SELECT
i_d
FROMbw_testtable
WHEREi_d
=? LIMIT 1, [20][xorm] [info] 2022/04/29 09:45:53.199763 [SQL] SELECT
i_d
FROMbw_testtable
WHEREi_d
=? LIMIT 1 [20] - 406.59µs[xorm] [debug] 2022/04/29 09:45:53.199797 [cache] cache ids: SELECT
i_d
FROMbw_testtable
WHEREi_d
=? LIMIT 1, 20[xorm] [debug] 2022/04/29 09:45:53.199889 [cache] get bean: bw_testtable, [20]
[xorm] [info] 2022/04/29 09:45:53.200783 [SQL] SELECT
i_d
,name
FROMbw_testtable
WHEREi_d
=? LIMIT 1 [20] - 857.924µs[xorm] [debug] 2022/04/29 09:45:53.200863 [cache] cache bean: bw_testtable, [20], &{20 created}
get &{20 created}
[xorm] [info] 2022/04/29 09:45:53.202191 [SQL] UPDATE
bw_testtable
SETname
= ? [update] - 1.232555ms[xorm] [debug] 2022/04/29 09:45:53.202219 [cache] clear table: bw_testtable
[xorm] [info] 2022/04/29 09:45:53.202919 [SQL] BEGIN TRANSACTION [] - 687.836µs
[xorm] [info] 2022/04/29 09:45:53.203398 [SQL] UPDATE
bw_testtable
SETname
= ? [update session] - 432.128µs[xorm] [debug] 2022/04/29 09:45:53.203428 [cache] clear table: bw_testtable
[xorm] [info] 2022/04/29 09:45:53.203724 [SQL] SELECT
i_d
FROMbw_testtable
[] - 237.675µs[xorm] [debug] 2022/04/29 09:45:53.203761 [cache] cache sql: 20, bw_testtable, SELECT
i_d
,name
FROMbw_testtable
, SELECTi_d
FROMbw_testtable
, [][xorm] [info] 2022/04/29 09:45:53.204151 [SQL] SELECT
i_d
,name
FROMbw_testtable
WHEREi_d
IN (?) [20] - 301.434µs[xorm] [debug] 2022/04/29 09:45:53.204261 [cache] cache bean: bw_testtable, [20], &{20 update}, [0xc0005767b0]
before delete &{20 update}
[xorm] [debug] 2022/04/29 09:45:53.204343 [cache] Get SQL: SELECT
i_d
FROMbw_testtable
WHEREi_d
=? ANDname
=? ANDi_d
=? LIMIT 1, [20 created 20][xorm] [info] 2022/04/29 09:45:53.204815 [SQL] SELECT
i_d
FROMbw_testtable
WHEREi_d
=? ANDname
=? ANDi_d
=? LIMIT 1 [20 created 20] - 443.279µs[xorm] [info] 2022/04/29 09:45:53.205137 [SQL] SELECT
i_d
,name
FROMbw_testtable
WHEREi_d
=? ANDname
=? ANDi_d
=? LIMIT 1 [20 created 20] - 267.931µsfind before commit &{20 created}
[xorm] [info] 2022/04/29 09:45:53.205590 [SQL] DELETE FROM
bw_testtable
WHEREi_d
=? [20] - 350.765µs[xorm] [info] 2022/04/29 09:45:53.207313 [SQL] COMMIT [] - 1.686394ms
[xorm] [debug] 2022/04/29 09:45:53.207409 [cache] cache hit sql: bw_testtable, SELECT
i_d
,name
FROMbw_testtable
, SELECTi_d
FROMbw_testtable
, [][xorm] [debug] 2022/04/29 09:45:53.207444 [cache] cache hit bean: bw_testtable, [20], &{20 update}
find after delete &{20 update}
[xorm] [debug] 2022/04/29 09:45:53.207519 [cache] Get SQL: SELECT
i_d
FROMbw_testtable
WHEREi_d
=? ANDname
=? ANDi_d
=? LIMIT 1, [20 created 20][xorm] [info] 2022/04/29 09:45:53.208162 [SQL] SELECT
i_d
FROMbw_testtable
WHEREi_d
=? ANDname
=? ANDi_d
=? LIMIT 1 [20 created 20] - 613.367µs[xorm] [info] 2022/04/29 09:45:53.208539 [SQL] SELECT
i_d
,name
FROMbw_testtable
WHEREi_d
=? ANDname
=? ANDi_d
=? LIMIT 1 [20 created 20] - 320.81µs