Sha256: 7c9cedf8ea1cc9270e4cacfe61d8b9e47ace0f1fdf30dc586a2e040b6c5ebc93
Contents?: true
Size: 765 Bytes
Versions: 2
Compression:
Stored size: 765 Bytes
Contents
module Catche module Model module Base extend ActiveSupport::Concern included do after_update :expire_resource! after_destroy :expire_resource! after_create :expire_collection! after_destroy :expire_collection! end def expire_collection! expire_cache! end def expire_resource! expire_cache! end def expire_cache! tags = Catche::Tag::Object.find_by_model(self.class).collect do |obj| self.instance_variable_set("@#{obj.options[:resource_name]}", self) obj.expiration_tags(self) end.flatten.compact.uniq Catche::Tag.expire! *tags end end end end ActiveRecord::Base.send :include, Catche::Model::Base
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
catche-0.1.1 | lib/catche/model/base.rb |
catche-0.1.0 | lib/catche/model/base.rb |