Caching: Add caching behavior, add null implementation.

This commit is contained in:
lain 2020-12-21 11:42:53 +01:00
commit ee81a94ab2
2 changed files with 24 additions and 3 deletions

View file

@ -21,9 +21,11 @@ defmodule Pleroma.NullCache do
def get(_, _), do: {:ok, nil}
@impl true
def fetch!(_, _, func) do
{_, res} = func.()
res
def fetch!(_, key, func) do
case func.(key) do
{_, res} -> res
res -> res
end
end
@impl true