为什么在有 "onOneServer" 时间表时需要 memcache/redis?

Why is memcache/redis needed when having an "onOneServer" schedule?

当面临涉及多个 Web 服务器的体系结构时 运行 连接同一个 laravel 应用程序,可用性问题就出现了。

当涉及两台服务器时,只有其中一台应该 运行 一个预定的作业。在那种情况下,您显然会使用 onOneServer 属性。

详情见the laravel documentation on that matter

现在是真正的问题:文档说

{note} To utilize this feature, your application must be using the memcached or redis cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server.

我只是不明白为什么使用数据库后端不可能做到这一点。如果您能提供任何提示,我将不胜感激。

干杯,托马斯

When Taylor introduced onOneServer() 特征,他是这样解释的:

Note: When using this feature, you will need to use the Redis or Memcached cache drivers. These drivers provide the atomicity needed to secure the locks that power this feature.

您可以阅读有关 distributed locking in redis 的更多信息。我知道一些数据库驱动程序,例如 MySQL 也提供 lock-features,因此我认为此功能也可能适用于这些驱动程序。但是,截至目前,它们尚未实施。