doocs / advanced-java

😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识
https://doocs.github.io/advanced-java
Creative Commons Attribution Share Alike 4.0 International
76.18k stars 19.07k forks source link

Is there an error about Delay-double-deletion's example code? #282

Closed alanchenggang closed 1 year ago

alanchenggang commented 1 year ago

There is an error in the code about delayed-double-deletion in the article<如何保证缓存与数据库的双写一致性>

public void set(key, value) {
    putToDb(key, value);
    deleteFromRedis(key);
    // ... a few seconds later
    deleteFromRedis(key);
}

And i google about this concept got this picture image

lujocom commented 1 year ago

您的邮件我已收到!我会尽快回复您的!!!

xiaopan1916 commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。您好,~您的邮件我已收到,谢谢!

yongroot commented 1 year ago

邮件已经正常接收。我会尽早查看,谢谢。

TopMonster commented 1 year ago

邮件已经收到 谢谢~!

zhFuture commented 1 year ago

您好,我将尽快给您回复。

nielongguang commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

kevin0016 commented 1 year ago

自动回复:您好,我是梁学凯,信已收到,

huxiqiang commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

onions1111 commented 1 year ago

信件已收到。

zgczjc commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近很忙,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

yanglbme commented 1 year ago

一堆自动回复啊

alanchenggang commented 1 year ago

一堆自动回复啊

这个延时双删是有问题不?

yanglbme commented 1 year ago

都是先延迟一段时间,再次删除缓存。没啥问题哈

alanchenggang commented 1 year ago

都是先延迟一段时间,再次删除缓存。没啥问题哈 我谷歌的都是这样的 类似环绕通知


public void set(key, value) {
deleteFromRedis(key);

putToDb(key, value); // ... a few seconds later deleteFromRedis(key); }