问题
So I have some items stored in Rails.cache and I always write them with :expires_in => 5.minutes
My question is, is there a way to see what the ttl is on a cache entry?
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.
I'm implementing rate limiting by the way.
回答1:
You can check ttl in Rails cache using command below.
Rails.cache.data.ttl("yourkey")
来源:https://stackoverflow.com/questions/24896449/checking-ttl-for-rails-cache-object