← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 4545.g.2.a.1

未来值封装异步结果

理解等级:中级

Future先返回一个代表尚未完成结果的对象,需要结果时调用方法等待。它把多项结果通道和缓存细节藏在接口之后,多次取值可复用已解析结果。一次初始化与结果发布需要同步;如果无人取结果,后台工作也应能够结束,接口本身不会自动提供取消或清理。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Cloud Native Patterns · 查看原书依据

      Future contains this complexity by encapsulating it in an API that provides the consumer with a simple interface whose method can be called normally, blocking all calling routines until all of its results are resolved. The interface that the value satisfies doesn’t have to be constructed specially for this purpose; any interface that’s convenient for

    参考来源

    - 位置:《Cloud Native Go》第04章《Cloud Native Patterns》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch04.xhtml) - 结论依据:Future先返回一个代表尚未完成结果的对象,需要结果时调用方法等待。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:Future contains this complexity by encapsulating it in an API that provides the consumer with a simple interface whose method can be called normally, blocking all calling routines until all of its results are resolved. The interface that the value satisfies doesn’t have to be constructed specially for this purpose; any interface that’s convenient for