Nostrum.Cache.GuildCache.Mnesia (nostrum v0.11.0-dev)

View Source

An Mnesia-based cache for guilds.

Please note that this module is only compiled if Mnesia is available on your system. See the Mnesia section of the State documentation for more information.

To retrieve the table name used by this cache, use table/0.

Summary

Functions

Create the given channel for the given guild in the cache.

Delete the channel from the given guild in the cache.

Update the channel on the given guild in the cache.

Returns a specification to start this module under a supervisor.

Clear any objects in the cache.

Create a guild from upstream data.

Remove the given guild from the cache.

Update the emoji list for the given guild in the cache.

Get a guild from the cache.

Set up the cache's Mnesia table.

Decrement the guild member count by one.

Increment the guild member count by one.

Create the given role in the given guild in the cache.

Delete the given role from the given guild in the cache.

Update the given role in the given guild in the cache.

Start the supervisor.

Update the sticker list for the given guild in the cache.

Retrieve the Mnesia table name used for the cache.

Drop the table used for caching.

Update the given guild in the cache.

Update guild voice states with the given voice state in the cache.

Wrap queries in a transaction.

Functions

channel_create(guild_id, channel)

(since 0.8.0)
@spec channel_create(Nostrum.Struct.Guild.id(), map()) :: Nostrum.Struct.Channel.t()

Create the given channel for the given guild in the cache.

channel_delete(guild_id, channel_id)

(since 0.8.0)

Delete the channel from the given guild in the cache.

channel_update(guild_id, channel)

(since 0.8.0)

Update the channel on the given guild in the cache.

child_spec(init_arg)

(since 0.8.0)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear()

(since 0.8.0)
@spec clear() :: :ok

Clear any objects in the cache.

create(payload)

(since 0.8.0)
@spec create(map()) :: Nostrum.Struct.Guild.t()

Create a guild from upstream data.

delete(guild_id)

(since 0.8.0)
@spec delete(Nostrum.Struct.Guild.id()) :: Nostrum.Struct.Guild.t() | nil

Remove the given guild from the cache.

emoji_update(guild_id, payload)

(since 0.8.0)

Update the emoji list for the given guild in the cache.

get(guild_id)

(since 0.8.0)
@spec get(Nostrum.Struct.Guild.id()) ::
  {:ok, Nostrum.Struct.Guild.t()} | {:error, :not_found}

Get a guild from the cache.

init(opts)

(since 0.8.0)

Set up the cache's Mnesia table.

member_count_down(guild_id)

(since 0.7.0)
@spec member_count_down(Nostrum.Struct.Guild.id()) :: true

Decrement the guild member count by one.

member_count_up(guild_id)

(since 0.7.0)
@spec member_count_up(Nostrum.Struct.Guild.id()) :: true

Increment the guild member count by one.

role_create(guild_id, payload)

(since 0.8.0)

Create the given role in the given guild in the cache.

role_delete(guild_id, role_id)

(since 0.8.0)

Delete the given role from the given guild in the cache.

role_update(guild_id, role)

(since 0.8.0)

Update the given role in the given guild in the cache.

start_link(opts)

(since 0.8.0)

Start the supervisor.

stickers_update(guild_id, stickers)

(since 0.8.0)

Update the sticker list for the given guild in the cache.

table()

(since 0.8.0)
@spec table() :: atom()

Retrieve the Mnesia table name used for the cache.

teardown()

(since 0.8.0)
@spec teardown() :: {:atomic, :ok} | {:aborted, term()}

Drop the table used for caching.

update(payload)

(since 0.8.0)
@spec update(map()) :: {Nostrum.Struct.Guild.t() | nil, Nostrum.Struct.Guild.t()}

Update the given guild in the cache.

voice_state_update(guild_id, payload)

(since 0.8.0)
@spec voice_state_update(Nostrum.Struct.Guild.id(), map()) ::
  {Nostrum.Struct.Guild.id(), [map()]}

Update guild voice states with the given voice state in the cache.

wrap_query(fun)

(since 0.8.0)

Wrap queries in a transaction.