Categories
Uncategorized

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s