Cacheable is a lightweight, db-agnostic low-level caching mechanism for Rails.
Add this line to your application's Gemfile:
gem 'cacheable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cacheable
In your model, do something like this
class MyModel
include Cacheable
def my_method
...
end
cacheable :my_method
end
It also works for class methods
class MyModel
include Cacheable
def self.my_method
...
end
class_cacheable :my_method
end
- 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