Skip to content

Provides a rails cache key for caching data that should be invalidated whenever any ActiveRecord instance of a specific type is created, updated, or destroyed

License

Notifications You must be signed in to change notification settings

kbaum/blanket_cachekey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlanketCachekey

Build Status Code Quality

Provides a rails cache key for caching data that should be invalidated whenever any ActiveRecord instance of a specific type is created, updated, or destroyed.

Installation

Add this line to your application's Gemfile:

gem 'blanket_cachekey'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blanket_cachekey

Usage

Include BlanketCachekey within your ActiveRecord class:

class Bar < ActiveRecord::Base

  include BlanketCachekey

end

Now Bar has a blanket_cachekey method which is updated whenever any instance of Bar is created, updated, or destroyed. This key can be used as part of a cache key.

= cache ['bars_selector', Bar.blanket_cachekey] do
  f.input :bars, collection: Bar.all

Now whenever any Bar is created, updated, or saved, the cache fragment above will be regenerated on the next hit.

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

About

Provides a rails cache key for caching data that should be invalidated whenever any ActiveRecord instance of a specific type is created, updated, or destroyed

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages