Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Volatile cache keys with Rails and Redis

Received: by 10.236.153.6 with SMTP id e6mr2516620yhk.20.1351917311938;
        Fri, 02 Nov 2012 21:35:11 -0700 (PDT)
X-BeenThere: rubyonrails-talk@googlegroups.com
Received: by 10.101.213.40 with SMTP id p40ls892303anq.7.gmail; Fri, 02 Nov
 2012 21:34:42 -0700 (PDT)
Received: by 10.236.114.164 with SMTP id c24mr310360yhh.17.1351917282432;
        Fri, 02 Nov 2012 21:34:42 -0700 (PDT)
Date: Fri, 2 Nov 2012 21:34:41 -0700 (PDT)
From: bricker <bricke...@gmail.com>
To: rubyonrails-talk@googlegroups.com
Message-Id: <3f4301e8-2e6f-4dcc-8b7e-011f60fa1152@googlegroups.com>
Subject: Volatile cache keys with Rails and Redis
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_4_21874993.1351917281987"

------=_Part_4_21874993.1351917281987
Content-Type: multipart/alternative; 
	boundary="----=_Part_5_30660509.1351917281987"

------=_Part_5_30660509.1351917281987
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

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

------=_Part_5_30660509.1351917281987
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

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":<div><br></div><div>&lt;%= cache @post do %&gt;</div><div><br></div><div>The cache-key will be something like&nbsp;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?</div><div><br></div><div>&lt;%= cache @post, expires_in: 1.month do %&gt;</div><div><br></div><div>Thanks,</div><div>Bryan</div>
------=_Part_5_30660509.1351917281987--

------=_Part_4_21874993.1351917281987--