SuperCache for rails is a caching middleware inspired by the "SuperCache" plugin for WordPress.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install super_cache
super_caches_page inside your controller with the action names to be cached.
class MyController < ApplicationController super_caches_page :index, :expires_in => 1.hour def index # action to be cached edn end
Super_cache will store the response body into
Rails.cache. The next time requesting
that action will get the same result.
There are several options can be passed to
cache_pathcontrol the cache key, defaults to the request uri.
expires_incontrol the expiration time, now defaults to 600 sec.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request