mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-05 02:09:03 +01:00
cba2897108
* Cache relationships in API * Fetch relationships for search results in UI * Only save one account's maps in each cache item
16 lines
359 B
Ruby
16 lines
359 B
Ruby
# 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
|