Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/identity_cache/query_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,20 @@ def cache_fetch_includes
# cache reads that happen from the ordering of callbacks. For example, if an after_commit
# callback enqueues a background job, then we don't want it to be possible for the
# background job to run and load data from the cache before it is invalidated.
def _run_commit_callbacks
if destroyed? || transaction_changed_attributes.present?
expire_cache
if ActiveRecord.version >= Gem::Version.new("7.1")
def run_callbacks(kind, type = nil, ignore_override: false)
Copy link
Member

@Edouard-chin Edouard-chin Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the ignore_override come from ?

I should RTFM

if kind == :commit && (destroyed? || transaction_changed_attributes.present?) && !ignore_override
expire_cache
end
super(kind, type)
end
else
def run_callbacks(kind)
if kind == :commit && (destroyed? || transaction_changed_attributes.present?)
expire_cache
end
super
end
super
end

# Invalidate the cache data associated with the record. Returns `true` on success,
Expand Down
Loading