Nostrum.Cache.ChannelCache (Nostrum v0.4.6) View Source

Cache for channels.

The ETS table name associated with the Channel Cache is :channels. Besides the methods provided below you can call any other ETS methods on the table.

Example

info = :ets.info(:channels)
[..., heir: :none, name: :channels, size: 1, ...]
size = info[:size]
1

Link to this section Summary

Functions

Retrieves a channel from the cache.

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

Link to this section Functions

Specs

Retrieves a channel from the cache.

Internally, the ChannelCache process only stores Nostrum.Struct.Channel.dm_channel/0 references. To get channel information, a call is made to a Nostrum.Cache.GuildCache.

If successful, returns {:ok, channel}. Otherwise, returns {:error, reason}

Example

case Nostrum.Cache.ChannelCache.get(133333333337) do
  {:ok, channel} ->
    "We found " <> channel.name
  {:error, _reason} ->
    "Donde esta"
end

Specs

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