ruby-on-rails - 如果 Redis 关闭,则禁用 Rails 缓存

标签 ruby-on-rails caching redis

我正在使用 Rails 4.1 并设置共享的 Redis ElasticCache 节点进行缓存。我试过 https://github.com/redis-store/redis-storehttps://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/

相关文章:

javascript - 如何让 axios-cache-adapter 使用 responseType blob 缓存文件下载?

python - 是否可以将 render_to_response 模板从 django 保存到服务器?

javascript - jQuery ui 自动完成缓存 xml 源

redis - 不存在 key 的 ServiceStack Redis 客户端行为

redis - 使用 StackExchange.Redis 连接到 redis 失败后事务不工作

go - 是否有任何自动增量机制用于使用 redigo 包装器将键值存储在 redis 中?

ruby-on-rails - 无方法错误 : undefined method `permit' for #<Hash:0x007facebc78c98> in Rails Minitest

ruby-on-rails - rails 开发 ssl 和 http

html - 前端 Rails 应用程序中的代码重用

ruby-on-rails - rails : How to extract values from JSON