我正在使用 Rails 4.1 并设置共享的 Redis ElasticCache 节点进行缓存。我试过 https://github.com/redis-store/redis-store和 https://github.com/sorentwo/readthis他们看起来很棒。
但是如果 Redis 宕机了怎么办? readthis 和 redis-store 都完全失败。我宁愿网站在没有缓存的情况下变慢也不愿死掉。
有人有想法吗?我提前谢谢你。
最佳答案
截至https://github.com/sorentwo/readthis/pull/30这可以直接在 Readthis 中获得。它将在即将发布的 1.2 版本中可用。来自自述文件:
In some situations it is desirable to keep serving requests from disk or the database if Redis crashes. This can be achieved wiht connection fault tolerance by enabling it at the top level:
Readthis.fault_tolerant = true
The default value is false, because while it may work for fetch operations, it isn't compatible with other state-based commands like increment.
关于ruby-on-rails - 如果 Redis 关闭,则禁用 Rails 缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33457765/