View Source Nostrum.Cache.ChannelCache.ETS (Nostrum v0.6.1)

An ETS-based cache for channels.

The supervisor defined by this module will set up the ETS table associated with it.

The default table name under which channels are cached is nostrum_channels. In addition to the cache behaviour implementations provided by this module, you can also call regular ETS table methods on it, such as :ets.info.

Note that users should not call the functions not related to this specific implementation of the cache directly. Instead, call the functions of Nostrum.Cache.ChannelCache directly, which will dispatch to the configured cache.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Converts and creates the given map as a channel in the cache.

Delete the channel from the cache by ID.

Retrieve a channel from the cache by ID.

Same as get/1, but raises Nostrum.Error.CacheError in case of a failure.

Set up the cache's ETS table.

Lookup a channel from the cache by ID and if it does not exist try to get from GuildCache with select_by

Start the supervisor.

Retrieve the ETS table name used for the cache.

Update the given channel in the cache.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

create(map()) :: Nostrum.Struct.Channel.t()

Converts and creates the given map as a channel in the cache.

Specs

Delete the channel from the cache by ID.

Specs

Retrieve a channel from the cache by ID.

Specs

Same as get/1, but raises Nostrum.Error.CacheError in case of a failure.

Set up the cache's ETS table.

Specs

lookup(Nostrum.Struct.Channel.id()) ::
  {:error, :channel_not_found} | {:ok, map()}

Lookup a channel from the cache by ID and if it does not exist try to get from GuildCache with select_by

Start the supervisor.

Specs

tabname() :: atom()

Retrieve the ETS table name used for the cache.

Specs

Update the given channel in the cache.