Add a fallback function to handle generic params, just in case

This commit is contained in:
rinpatch 2019-01-16 10:38:42 +03:00
parent a76793006b
commit a9c27e137d
1 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,14 @@ def get_cached_tags(%{user: user} = params) 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 =