aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_text/attachments/caching.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/action_text/attachments/caching.rb')
-rw-r--r--lib/action_text/attachments/caching.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/action_text/attachments/caching.rb b/lib/action_text/attachments/caching.rb
new file mode 100644
index 0000000000..b867e2ff91
--- /dev/null
+++ b/lib/action_text/attachments/caching.rb
@@ -0,0 +1,14 @@
+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