<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>缓存一致性 on Plbear | 后端架构 · AI工程 · 云原生技术博客</title><link>https://www.plbear.com/tags/%E7%BC%93%E5%AD%98%E4%B8%80%E8%87%B4%E6%80%A7/</link><description>Recent content in 缓存一致性 on Plbear | 后端架构 · AI工程 · 云原生技术博客</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Wed, 05 Jul 2023 09:00:00 +0800</lastBuildDate><atom:link href="https://www.plbear.com/tags/%E7%BC%93%E5%AD%98%E4%B8%80%E8%87%B4%E6%80%A7/index.xml" rel="self" type="application/rss+xml"/><item><title>GORM 钩子与事务：缓存一致性的终极方案</title><link>https://www.plbear.com/posts/2023-07-05-gorm-hook-cache-consistency/</link><pubDate>Wed, 05 Jul 2023 09:00:00 +0800</pubDate><guid>https://www.plbear.com/posts/2023-07-05-gorm-hook-cache-consistency/</guid><description>先删缓存再写库还是先写库再删缓存？都有脏读窗口。GORM AfterSave 钩子里联动 Redis 双向清理，删缓存失败直接回滚 DB 事务——从机制上杜绝脏读，而不是靠概率。</description></item></channel></rss>