Forum: Ruby on Rails Volatile cache keys with Rails and Redis

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb56e6fa19ee55379e313367f049c1f9?d=identicon&s=25 bricker (Guest)
on 2012-11-03 05:35
(Received via mailing list)
Does Rails automatically set an EXPIRE attribute on keys when working
with
Redis, or will an old key sit there forever if it's never manually
cleared
out? This is mostly a concern when using ActiveModel's "cache_key":

<%= cache @post do %>

The cache-key will be something like views/posts/744-20120613070958 .
When
the post is updated, and therefore gets a new cache-key, what happens to
the old one? Will it just sit there forever? Do I need to add an
`expires_in` option to every cache call, just to make sure it gets
cleaned
up every once in a while?

<%= cache @post, expires_in: 1.month do %>

Thanks,
Bryan
83a96a69fb6b2a1ce108d9e192a6f019?d=identicon&s=25 Jeffrey Jones (Guest)
on 2012-11-05 04:18
(Received via mailing list)
The idea is that your cache system should expire the oldest items in the
cache automatically when it hits its pre-configured size limit.
This topic is locked and can not be replied to.