Ruby on Rails
Action Cache Update Plugin
This is a drop in replacement for the Rails Action Cache. When this plugin is installed, the new behavior will take effect without any further configuration.
All documentation for the Rails Action Cache is still relevant.
Features
- Store cache entries as YAML streams so the Response headers from the original response can be returned with cache hits
- Add a ‘last-modified’ header to the response to get the client to use a get-if-modified request
- If the client has the response we have cached, don’t send it again, send a ‘304 Not Modified’ response to reduce data on the wire
- Fix a bug in the original Rails code where responses other than ‘200 OK’ are cached (since the headers aren’t cached in the original, all the clients would get is an empty ‘200 OK’ response from subsequent requests)
- Allow clients to provide their own implementation of the cache key for the actions, e.g.
- environment.rb
ActionController::Caching::Actions::ActionCacheFilter.fragment_key = Proc.new {|controller|
"AC:#{controller.request.host_with_port}:#{controller.params.sort.join(':').gsub(' ', '-')}"
}
- Allow an action to specify a Time To Live for the cached item. Set ’@response.time_to_live’ to the number of seconds before this cached item will be expired. If not set, the default setting of ‘never’ will be used and the item will only be expired by using the regular action cache expiry mechanism.
def my_action
@response.time_to_live = 10.minutes
...
end
Versions
January 20, 2006 – v0.0.2
- Added the ability to replace the fragment_key method to implement your own cache key
January 20, 2006 – v0.0.3
- Added timed expiry of action cache items
svn: http://craz8.com/svn/trunk/plugins/action_cache
See also Plugins, Rails Action Cache upgrade
Update?
Is this plugin still being maintained? Does it work with Edge Rails still (as of 8/31/06)?
Updated
on September 01, 2006 01:28
by
Dave Myron (67.168.68.29)