mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
20 lines
472 B
Ruby
20 lines
472 B
Ruby
# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
module ApplicationModel::HasCache
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
after_commit :cache_delete
|
|
end
|
|
|
|
def cache_update(other)
|
|
cache_delete if respond_to?(:cache_delete)
|
|
other.cache_delete if other.respond_to?(:cache_delete)
|
|
ActiveSupport::CurrentAttributes.clear_all
|
|
true
|
|
end
|
|
|
|
def cache_delete
|
|
Rails.cache.delete("#{self.class}::aws::#{id}")
|
|
end
|
|
end
|