Sha256: 444576d1dc5754105d8583edc453bcbdb9a1047cb350a5ef34f66f9298ed4dc6

Contents?: true

Size: 1021 Bytes

Versions: 1

Compression:

Stored size: 1021 Bytes

Contents

# RailsCacheIt

Help you easy to 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 expires_in: 5.minutes`

or use block

`User.limit(50).cache_it{ User.count}`

when block.call != pre_block.call
cache will expires

###allowed options

view [AvtiveSupport::Cache::Store#fetch](http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch)

###set default options

`RailsCacheIt.default_options.merge!(options)`

## 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_cache_it-0.0.2 README.md