Ah, ok, that makes sense. I think I should submit a PR for the docs on that.
I ended up with something like this:
def get_cached_thing!(slug) do
{status, thing} = Cachex.get(:my_cache, slug, fallback: fn(slug) ->
Repo.get_by!(Mything, slug: slug)
end)
case status do
:loaded -> thing
:error -> "That thing does not exist"
end
end
That works, but I’m open to any comments/improvements/suggestions. Not sure how idiomatic that solution is. Thanks!


















