Commit a173fb9e authored by lain's avatar lain
Browse files

Get users fresh, might so we don't make new keys all the time.

parent bb1d08a4
......@@ -123,6 +123,10 @@ def get_cached_by_nickname(nickname) do
Cachex.get!(:user_cache, key, fallback: fn(_) -> Repo.get_by(User, nickname: nickname) end)
def get_cached_by_nickname(nickname) do
Repo.get_by(User, nickname: nickname)
def get_cached_user_info(user) do
key = "user_info:#{}"
Cachex.get!(:user_cache, key, fallback: fn(_) -> user_info(user) end)
......@@ -20,7 +20,7 @@ def webfinger(resource) do
regex = ~r/(acct:)?(?<username>\w+)@#{host}/
case Regex.named_captures(regex, resource) do
%{"username" => username} ->
user = User.get_cached_by_nickname(username)
user = User.get_by_nickname(username)
{:ok, represent_user(user)}
_ -> nil
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment