diff options
Diffstat (limited to 'actiontext/lib/action_text/attachments/caching.rb')
-rw-r--r-- | actiontext/lib/action_text/attachments/caching.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/actiontext/lib/action_text/attachments/caching.rb b/actiontext/lib/action_text/attachments/caching.rb new file mode 100644 index 0000000000..7c727bfc26 --- /dev/null +++ b/actiontext/lib/action_text/attachments/caching.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module ActionText + module Attachments + module Caching + def cache_key(*args) + [self.class.name, cache_digest, *attachable.cache_key(*args)].join("/") + end + + private + def cache_digest + Digest::SHA256.hexdigest(node.to_s) + end + end + end +end |