Fix call to inefficient delete_matched
cache method in domain blocks (#28367)
This commit is contained in:
parent
90371a4fc4
commit
d7875adad2
11 changed files with 104 additions and 57 deletions
|
@ -18,16 +18,12 @@ class AccountDomainBlock < ApplicationRecord
|
|||
belongs_to :account
|
||||
validates :domain, presence: true, uniqueness: { scope: :account_id }, domain: true
|
||||
|
||||
after_commit :remove_blocking_cache
|
||||
after_commit :remove_relationship_cache
|
||||
after_commit :invalidate_domain_blocking_cache
|
||||
|
||||
private
|
||||
|
||||
def remove_blocking_cache
|
||||
def invalidate_domain_blocking_cache
|
||||
Rails.cache.delete("exclude_domains_for:#{account_id}")
|
||||
end
|
||||
|
||||
def remove_relationship_cache
|
||||
Rails.cache.delete_matched("relationship:#{account_id}:*")
|
||||
Rails.cache.delete(['exclude_domains', account_id, domain])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue