知识卡片
重试需幂等结果
幂等操作重复执行仍得到同样结果。计数场景可传入已经计算好的目标值,使重试重复赋相同值;也可传入先前读到的预期值,只有当前值仍匹配时才增加,重复请求便不再满足条件。这两者依赖具体业务语义,尤其目标值覆盖不能自动解决并发写者的冲突。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 实现简单业务逻辑 · 查看原书依据
As in the previous example, there is no simple fix for this issue. It all depends on the business domain and its needs. In this specific example, one way to ensure transactional behavior is to make the operation idempotent: that is, leading to the same result even if the operation repeated multiple times. For example,
参考来源
- 位置:《Learning Domain-Driven Design》第5章《实现简单业务逻辑》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch05.html)
- 结论依据:原文对该概念的定义、应用条件及相邻概念的比较支撑本卡解释。
- 原始内容:As in the previous example, there is no simple fix for this issue. It all depends on the business domain and its needs. In this specific example, one way to ensure transactional behavior is to make the operation idempotent: that is, leading to the same result even if the operation repeated multiple times. For example,