Rails memcache store default auto expiration time
dalli, memcached, ruby-on-rails
Solution
If you're using the default, built-in `MemCacheStore` class provided by Rails, then no. It won't assume an expiry time when you create new cache entries. You can read the applicable code to verify that. It checks to see if you've passed an `expires_in` option to the `#write` method like
Rails.cache.write("key", "content", expires_in: 2.hours)
and if you haven't, simply passes 0 to memcache indicating no expiry time. Hope this helps!
Problem
I have been struggling for a while to find out if there is some default expiration time set by Rails, in case we don't provide any while storing a key-value pair to memcache? e.g. Rails.cache.write('some-key', 'some-value') Would rails set some expiration time by default if we haven't specified?