RailsCacheIt
Help you cache with ActiveRecord.
Only support Rails program.
Installation
Add this line to your application's Gemfile:
gem 'rails_cache_it'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails_cache_it
Usage
cache
User.limit(50).cache_it
Only work on Relation now(it means you can't use it with #first #last etc..).
expires
User.limit(50).cache_it{ User.count}
when block.call != pre_block.call cache will expires
allowed options
view AvtiveSupport::Cache::Store#fetch
set default options
RailsCacheIt.default_options.merge(options)
Contributing
- 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