This project is archived and is in readonly mode.

#6308 new
Brian Durand

Fix FileStore cleanup method

Reported by Brian Durand | January 18th, 2011 @ 06:10 PM

The cleanup method on ActiveSupport::Cache::FileStore on the 3.0 branch is defined but doesn't actually work. I have fixed the implementation so it can be used to clean up old cache entries either by expiration time or by how recently they've been used and added tests.

This method is needed to keep the cache from growing without bound until if fills up the disk.

The syntax is:

Rails.cache.cleanup(:expired_only => true)


Rails.cache.cleanup(:not_accessed_in => 2.days)

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>