diff --git a/lib/identity_cache/parent_model_expiration.rb b/lib/identity_cache/parent_model_expiration.rb index 25fbb956..fcd9e0e0 100644 --- a/lib/identity_cache/parent_model_expiration.rb +++ b/lib/identity_cache/parent_model_expiration.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module IdentityCache - module ParentModelExpiration # :nodoc: + # @api private + module ParentModelExpiration extend ActiveSupport::Concern include ArTransactionChanges @@ -35,9 +36,16 @@ def lazy_hooks end end + module ClassMethods + def parent_expiration_entries + ParentModelExpiration.install_pending_parent_expiry_hooks(cached_model) + _parent_expiration_entries + end + end + included do - class_attribute(:parent_expiration_entries) - self.parent_expiration_entries = Hash.new { |hash, key| hash[key] = [] } + class_attribute(:_parent_expiration_entries) + self._parent_expiration_entries = Hash.new { |hash, key| hash[key] = [] } end def expire_parent_caches @@ -49,7 +57,6 @@ def expire_parent_caches end def add_parents_to_cache_expiry_set(parents_to_expire) - ParentModelExpiration.install_pending_parent_expiry_hooks(cached_model) self.class.parent_expiration_entries.each do |association_name, cached_associations| parents_to_expire_on_changes(parents_to_expire, association_name, cached_associations) end