Ruby on Rails的Action Cable适配器是什么?

5

我正在查看RoR action cable指南http://edgeguides.rubyonrails.org/action_cable_overview.html#subscription-adapter,但是没有找到有关action cable adapter的详细信息。

development:
  adapter: async

test:
  adapter: async

production:
  adapter: redis
  url: redis://10.10.3.153:6381

您能解释一下什么是异步适配器,以及为什么我需要在生产环境中使用redis作为适配器吗?


你已经到达了指南的配置部分以及它提供的依赖关系链接吗?http://edgeguides.rubyonrails.org/action_cable_overview.html#configuration - heyitsjhu
1个回答

5
async适配器是inline适配器的异步版本,它将pubs/subs存储在Rails实例的内存中,因此如果给定的实例被终止,则所有数据都将丢失。出于同样的原因,它不具备可扩展性。
Rails推荐使用Redis,因为它比PostgreSQL快得多。
如果你真的想知道所有订阅适配器是如何工作的,可以查看它们的源代码

2
这并没有回答异步适配器实际是什么。 - Ákos Vandra-Meyer

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接