【发布时间】:2017-02-13 14:12:40
【问题描述】:
我在应用中使用的某处
Rails.cache.write 'some_key', 'some_value', expires_in: 1.week
在我的应用程序的另一部分,我想弄清楚该缓存项还剩下多少时间。
我该怎么做?
【问题讨论】:
-
缓存存储是内部的,所以你不能。但是您可以为某些缓存存储更新 ttl(例如
touch用于 memcached) -
我使用 Redis。有没有办法
touch在那里缓存项目? -
在redis中它被称为
expire(这里是例子如果你使用redis-rb适配器github.com/redis/redis-rb/wiki/Redis-rb-Overview)
标签: ruby-on-rails caching