检查ttl中的Rails.cache对象 [英] checking ttl for Rails.cache object
本文介绍了检查ttl中的Rails.cache对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我有一些存储在Rails.cache中的项目,我总是用:expires_in => 5.minutes
So I have some items stored in Rails.cache and I always write them with :expires_in => 5.minutes
我的问题是,有没有办法看看缓存条目上的ttl是什么?
My question is, is there a way to see what the ttl is on a cache entry?
我知道activesupport中的入口类有一个方法,但是我似乎无法从Rails.cache方法中获得入口对象。
I know the entry class in activesupport has a method but I can't seem to get an entry object out of Rails.cache methods.
我正在实施限速。
推荐答案
您可以使用以下命令在Rails缓存中检查ttl。
You can check ttl in Rails cache using command below.
Rails.cache.data.ttl("yourkey")
这篇关于检查ttl中的Rails.cache对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文