1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-28 23:08:25 +09:00
mastodon/app/models/concerns/relationship_cacheable.rb

17 lines
359 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module RelationshipCacheable
extend ActiveSupport::Concern
included do
after_commit :remove_relationship_cache
end
private
def remove_relationship_cache
Rails.cache.delete("relationship:#{account_id}:#{target_account_id}")
Rails.cache.delete("relationship:#{target_account_id}:#{account_id}")
end
end