<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>库存预占 on PlumePHP</title><link>https://plumephp.com/tags/%E5%BA%93%E5%AD%98%E9%A2%84%E5%8D%A0/</link><description>Recent content in 库存预占 on PlumePHP</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Mon, 19 Jul 2021 08:28:00 +0800</lastBuildDate><atom:link href="https://plumephp.com/tags/%E5%BA%93%E5%AD%98%E9%A2%84%E5%8D%A0/index.xml" rel="self" type="application/rss+xml"/><item><title>库存预占架构：交易、合成和消耗如何避免同一件物品被用两次</title><link>https://plumephp.com/game-server-inventory-reservation-architecture/</link><pubDate>Mon, 19 Jul 2021 08:28:00 +0800</pubDate><guid>https://plumephp.com/game-server-inventory-reservation-architecture/</guid><description>&lt;h2 id="背景问题通常藏在正常路径之外"&gt;背景：问题通常藏在正常路径之外&lt;/h2&gt;
&lt;p&gt;背包里的同一件物品可能同时被多个流程盯上：玩家拿它去交易，又点了强化，还提交了任务。只靠最终扣除时检查一次，容易在并发和重试下出现重复使用。库存预占架构让物品在进入高风险流程前先被锁定，流程结束后确认消耗或释放。&lt;/p&gt;</description></item></channel></rss>