Module: Sequel::Unicache::Hook::InstanceMethods
- Defined in:
- lib/sequel/unicache/hook.rb
Instance Method Summary collapse
- #after_commit ⇒ Object
- #after_destroy_commit ⇒ Object
- #after_destroy_rollback ⇒ Object
- #after_rollback ⇒ Object
- #before_destroy ⇒ Object
- #before_update ⇒ Object
Instance Method Details
#after_commit ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/sequel/unicache/hook.rb', line 13 def after_commit if Unicache.enabled? Write.expire self @_unicache_previous_values = nil end super end |
#after_destroy_commit ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/sequel/unicache/hook.rb', line 26 def after_destroy_commit if Unicache.enabled? Write.expire self @_unicache_previous_values = nil end super end |
#after_destroy_rollback ⇒ Object
34 35 36 37 |
# File 'lib/sequel/unicache/hook.rb', line 34 def after_destroy_rollback @_unicache_previous_values = nil if Unicache.enabled? super end |
#after_rollback ⇒ Object
21 22 23 24 |
# File 'lib/sequel/unicache/hook.rb', line 21 def after_rollback @_unicache_previous_values = nil if Unicache.enabled? super end |
#before_destroy ⇒ Object
39 40 41 42 43 44 |
# File 'lib/sequel/unicache/hook.rb', line 39 def before_destroy if Unicache.enabled? && !Write.check_completeness?(self) && primary_key @_unicache_previous_values = self.class.with_pk(pk).values end super end |
#before_update ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/sequel/unicache/hook.rb', line 46 def before_update if Unicache.enabled? # Store all previous values, to be expired @_unicache_previous_values = initial_values.merge(@_unicache_previous_values || {}) end super end |