Add a fallback function to handle generic params, just in case
authorrinpatch <rinpatch@sdf.org>
Wed, 16 Jan 2019 07:38:42 +0000 (10:38 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 16 Jan 2019 07:38:42 +0000 (10:38 +0300)
lib/pleroma/web/metadata.ex

index bc0f3beed268802128f345e1120acd10716ecb6b..23f152e068ca5cffd29e83f4a7c5769a0060203e 100644 (file)
@@ -20,6 +20,14 @@ defmodule Pleroma.Web.Metadata do
     end)
   end
 
+  def get_cached_tags(params) do
+    key = :erlang.term_to_binary(params)
+
+    Cachex.fetch!(:metadata_cache, key, fn _key ->
+      {:commit, build_tags(params)}
+    end)
+  end
+
   def build_tags(params) do
     Enum.reduce(@parsers, "", fn parser, acc ->
       rendered_html =