Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (53 sloc) 1.25 KB
defmodule Crux.Cache.Default do
@moduledoc """
A provider using the default caches:
* `Crux.Cache.Guild`
* `Crux.Cache.Channel`
* `Crux.Cache.Emoji`
* `Crux.Cache.Presence`
* `Crux.Cache.User`
"""
alias Crux.Cache
use Cache.Provider
@spec init(term()) :: {:ok, tuple()}
def init(_) do
children = [
Cache.Guild.Supervisor.Supervisor,
Cache.Channel,
Cache.Emoji,
Cache.Presence,
Cache.User
]
Supervisor.init(children, strategy: :one_for_one)
end
@doc """
The default guild cache.
"""
@impl true
@spec guild_cache() :: module()
def guild_cache(), do: Cache.Guild
@doc """
The default guild cache: `Crux.Cache.Channel`.
"""
@impl true
@spec channel_cache() :: module()
def channel_cache(), do: Cache.Channel
@doc """
The default guild cache: `Crux.Cache.Emoji`.
"""
@impl true
@spec emoji_cache() :: module()
def emoji_cache(), do: Cache.Emoji
@doc """
The default guild cache: `Crux.Cache.Presence`.
"""
@impl true
@spec presence_cache() :: module()
def presence_cache(), do: Cache.Presence
@doc """
The default guild cache: `Crux.Cache.User`.
"""
@impl true
@spec user_cache() :: module()
def user_cache(), do: Cache.User
end
You can’t perform that action at this time.