Module: IdentityCache::QueryAPI
- Extended by:
- ActiveSupport::Concern
- Included in:
- WithoutPrimaryIndex
- Defined in:
- lib/identity_cache/query_api.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#expire_cache ⇒ Object
Invalidate the cache data associated with the record.
- #run_callbacks(kind) ⇒ Object
- #was_new_record? ⇒ Boolean private
Instance Method Details
#expire_cache ⇒ Object
Invalidate the cache data associated with the record. Returns ‘true` on success, `false` otherwise.
186 187 188 189 190 191 |
# File 'lib/identity_cache/query_api.rb', line 186 def expire_cache expired_parent_caches = expire_parent_caches expired_attribute_indexes = expire_attribute_indexes expired_parent_caches && expired_attribute_indexes end |
#run_callbacks(kind) ⇒ Object
169 170 171 172 173 174 |
# File 'lib/identity_cache/query_api.rb', line 169 def run_callbacks(kind, type = nil) if kind == :commit && (destroyed? || transaction_changed_attributes.present?) expire_cache end super end |
#was_new_record? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
194 195 196 197 |
# File 'lib/identity_cache/query_api.rb', line 194 def was_new_record? # :nodoc: pk = self.class.primary_key !destroyed? && transaction_changed_attributes.key?(pk) && transaction_changed_attributes[pk].nil? end |