Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

checking ttl for Rails.cache object

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.

like image 554
Ldrbrandon Avatar asked Dec 06 '25 03:12

Ldrbrandon


1 Answers

You can check ttl in Rails cache using command below.

Rails.cache.data.ttl("yourkey")
like image 99
Marcelo Austria Avatar answered Dec 08 '25 17:12

Marcelo Austria



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!