Skip to content

Commit 40a6241

Browse files
committed
Update Java Notes
1 parent b7ea86d commit 40a6241

File tree

3 files changed

+622
-222
lines changed

3 files changed

+622
-222
lines changed

DB.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10902,7 +10902,7 @@ Cache Aside Pattern 中服务端需要同时维系 DB 和 cache,并且是以 D
1090210902

1090310903
时序导致的不一致问题:
1090410904

10905-
* 在写数据的过程中,不能先删除 cache 再更新 DB,因为会造成缓存的不一致。比如请求 1 先写数据 A,请求2随后读数据 A,当请求 1 删除 cache 后,请求 2 直接读取了 DB,此时请求 1 还没写入 DB
10905+
* 在写数据的过程中,不能先删除 cache 再更新 DB,因为会造成缓存的不一致。比如请求 1 先写数据 A,请求 2 随后读数据 A,当请求 1 删除 cache 后,请求 2 直接读取了 DB,此时请求 1 还没写入 DB
1090610906

1090710907
* 在写数据的过程中,先更新 DB 再删除 cache 也会出现问题,但是概率很小,因为缓存的写入速度非常快
1090810908

0 commit comments

Comments
 (0)