Module: Cash::WriteThrough::InstanceMethods
- Defined in:
- lib/cash/write_through.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_to_caches ⇒ Object
- #expire_caches ⇒ Object
- #remove_from_caches ⇒ Object
- #shallow_clone ⇒ Object
- #update_caches ⇒ Object
Class Method Details
.included(active_record_class) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/cash/write_through.rb', line 11 def self.included(active_record_class) active_record_class.class_eval do after_create :add_to_caches after_update :update_caches after_destroy :remove_from_caches end end |
Instance Method Details
#add_to_caches ⇒ Object
19 20 21 |
# File 'lib/cash/write_through.rb', line 19 def add_to_caches InstanceMethods.unfold(self.class, :add_to_caches, self) end |
#expire_caches ⇒ Object
32 33 34 |
# File 'lib/cash/write_through.rb', line 32 def expire_caches InstanceMethods.unfold(self.class, :expire_caches, self) end |
#remove_from_caches ⇒ Object
27 28 29 30 |
# File 'lib/cash/write_through.rb', line 27 def remove_from_caches return if new_record? InstanceMethods.unfold(self.class, :remove_from_caches, self) end |
#shallow_clone ⇒ Object
36 37 38 |
# File 'lib/cash/write_through.rb', line 36 def shallow_clone self.class.send(:instantiate, instance_variable_get(:@attributes)) end |
#update_caches ⇒ Object
23 24 25 |
# File 'lib/cash/write_through.rb', line 23 def update_caches InstanceMethods.unfold(self.class, :update_caches, self) end |