This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Sun Jun 28 22:28:10 -0700 2009 | |
| |
README.md | Mon Sep 14 23:34:14 -0700 2009 | |
| |
init.rb | Sun Jun 28 22:28:10 -0700 2009 | |
| |
lib/ | Mon Oct 19 16:54:29 -0700 2009 |
README.md
Filestore Cache Expires_in Plugin
Adds a :expires_in option to Rails filestore caching, in line with memcached store. Providing a very easy way to add high capacity caching to a site.
Model observers and sweepers are still useable as well, of course.
Filestore caching is a much easier method of caching to implement quickly than memcached, since it just involves writing the cache data to files in the tmp/ directory (also making it good for shared hosting environments).
Installation
1) Install plugin
./script/plugin install git://github.com/adamsalter/filestore_expires_in-plugin.git
2) Enable :file_store caching
config/environments/production.rb:
config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
Useage
On controller classes:
class MyController < ApplicationController
caches_action :show, {:if => etc.}, {:expires_in => 1.day}
end
In controller methods:
unless read_fragment({:controller => 'mycontroller', etc.}, {:expires_in => 1.day})
#code here
end
In views:
cache({:controller => 'mycontroller', etc.}, {:expires_in => 1.day}) do
#fragment here
end
In models:
cache_key = "models/my_model/%s?%s-%s-%s" % ["model_method_name", self.value, page, limit]
result = Rails.cache.fetch(cache_key, :expires_in => 1.day) do
# result data to be cached
end
Copyright (c) 2009 Adam @ Codebright.net, released under the MIT license







