0.0
Low commit activity in last 3 years
No release in over a year
An ActiveRecord extension that allows for caching based on latest updated_at time.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.2.0
 Project Readme

ModelCache

An ActiveRecord extension that allows for caching based on latest updated_at time.

This is particularly useful when some expensive data depends on the entire contents of the table.

Usage

# Return the latest updated_at of a collection, and uses Rails.cache to cache it.
Model.updated_at

# Caches and returns contents of the block based on the Model.updated_at and cache_key.
Model.cache(cache_key, options = {}, &block)

# Returns a method after passing it through the Model.cache method.
Model.cached_* # (e.g. User.cached_all)

# Same as Model.cached_*, but on a model instance.
model_instance.cached_* # (e.g. user.cached_things)

Installation

Install with RubyGems:

gem install model_cache

License

Copyright (c) 2016 Patrick Hogan, released under the MIT License. http://www.opensource.org/licenses/mit-license