A simple caching middleware for rails.
Ruby
Switch branches/tags
Nothing to show
Latest commit 58c2bf6 Apr 13, 2013 @ShiningRay ShiningRay fix tests
Permalink
Failed to load latest commit information.
lib fix tests Apr 13, 2013
test fix tests Apr 13, 2013
.gitignore
.travis.yml unit test for cache_meta_info Apr 13, 2013
Gemfile unit test for cache_meta_info Apr 13, 2013
LICENSE.txt initial commit Mar 2, 2013
README.md Update README.md Mar 11, 2013
Rakefile
super_cache.gemspec release 0.0.2 Mar 8, 2013

README.md

Build Status

SuperCache

SuperCache for rails is a caching middleware inspired by the "SuperCache" plugin for WordPress.

Installation

Add this line to your application's Gemfile:

gem 'super_cache'

And then execute:

$ bundle

Or install it yourself as:

$ gem install super_cache

Usage

Just call 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 super_caches_page:

  • cache_path control the cache key, defaults to the request uri.
  • expires_in control the expiration time, now defaults to 600 sec.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request