知识卡片
内存列表仅模拟订单状态
用进程内列表存放订单,可以快速演示创建、读取和状态变更,但状态只随当前进程存在,无法替代持久化与跨实例共享。书中明确把它作为简化教学实现,并把控制层和数据持久化留到后章;不能据此推断已具备真实支付或可靠订单处理能力。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 2 章《A basic API implementation》(源文件:_epub-src/OEBPS/Text/02.htm)
- 结论依据:2.7 节明确说为保持实现简单而用 Python 列表管理内存中的订单,后续章节才加入稳健控制器与持久化层;当前 pay 端点代码仅改变状态字段。
- 原始内容:To keep the implementation simple, we’ll represent the collection of orders as a Python list. We’ll manage the list within the view functions of the API layer. In chapter 7, you’ll learn useful patterns to add a robust controller and data persistence layers to the application.