Module: DatabaseCachedAttribute

Extended by:
ActiveSupport::Concern
Defined in:
lib/database_cached_attribute.rb,
lib/database_cached_attribute/version.rb

Overview

DatabaseCachedAttribute adds a method to add a set of easy to use cache invalidation methods/callbacks for specified attributes

On the model where you possibly may want to cache things from this model that may be heavy to create:

include DatabaseCachedAttribute
database_cached_attribute :attribute_name, :another_attribute_name

This will create the methods

invalidate_attribute_name(optional_object)
invalidate_another_attribute_name(optional_object)
cache_attribute_name(optional_object)
cache_another_attribute_name(optional_object)

Which means invalidating that attribute is easy, say when you add an associated object

has_many :things, before_add: :invalidate_attribute, before_remove: :invalidate_other_attribute

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VERSION =
"0.1.0"
VERSION_ARRAY =

:nodoc:

VERSION.split(/\./).map { |x| x.to_i }
VERSION_MAJOR =

:nodoc:

VERSION_ARRAY[0]
VERSION_MINOR =

:nodoc:

VERSION_ARRAY[1]
VERSION_BUILD =

:nodoc:

VERSION_ARRAY[2]