TimedFileStore Plugin 0.1

My first rails plugin: timed_file_store is now available. It lets you expire fragments based upon the time of the cached file. It’s fairly easy to use; just bung this into config/environments.rb:

  ActionController::Base.fragment_cache_store =
    TimedFileStore.new("#{RAILS_ROOT}/tmp/cache", :atime => 15.minutes)

And now any fragments which haven’t been accessed in the last 15 minutes will be removed the next time that they’re accessed.

This is rather coarse—it applies to all fragments. But it’s also pretty simple and does what I need for now.

Comments are Closed