View Source Nostrum.Cache.GuildCache.Mnesia (Nostrum v0.9.0)

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.

Set up the cache's Mnesia table.

Decrement the guild member count by one.

Increment the guild member count by one.

Get a QLC handle for the guild cache.

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.

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 QLC operations in a transaction.

Functions

Link to this function

channel_create(guild_id, channel)

View Source (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.

Link to this function

channel_delete(guild_id, channel_id)

View Source (since 0.8.0)

Delete the channel from the given guild in the cache.

Link to this function

channel_update(guild_id, channel)

View Source (since 0.8.0)

Update the channel on the given guild in the cache.

Link to this function

child_spec(init_arg)

View Source (since 0.8.0)

Returns a specification to start this module under a supervisor.

See Supervisor.

@spec clear() :: :ok

Clear any objects in the cache.

Link to this function

create(payload)

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

Create a guild from upstream data.

Link to this function

delete(guild_id)

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

Remove the given guild from the cache.

Link to this function

emoji_update(guild_id, payload)

View Source (since 0.8.0)

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

Link to this function

init(init_arg)

View Source (since 0.8.0)

Set up the cache's Mnesia table.

Link to this function

member_count_down(guild_id)

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

Decrement the guild member count by one.

Link to this function

member_count_up(guild_id)

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

Increment the guild member count by one.

Link to this function

query_handle()

View Source (since 0.8.0)
@spec query_handle() :: :qlc.query_handle()

Get a QLC handle for the guild cache.

Link to this function

role_create(guild_id, payload)

View Source (since 0.8.0)

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

Link to this function

role_delete(guild_id, role_id)

View Source (since 0.8.0)

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

Link to this function

role_update(guild_id, role)

View Source (since 0.8.0)

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

Link to this function

start_link(init_arg)

View Source (since 0.8.0)

Start the supervisor.

@spec table() :: atom()

Retrieve the Mnesia table name used for the cache.

Link to this function

teardown()

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

Drop the table used for caching.

Link to this function

update(payload)

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

Update the given guild in the cache.

Link to this function

voice_state_update(guild_id, payload)

View Source (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.

Link to this function

wrap_qlc(fun)

View Source (since 0.8.0)

Wrap QLC operations in a transaction.