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

View Source

An Mnesia-based cache for guild members.

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

Bulk create a chunk of members for the given guild in the cache.

Stream all members on the given guild.

Stream all members with the given user ID.

Returns a specification to start this module under a supervisor.

Clear any objects in the cache.

Add the given member to the given guild in the cache.

Remove the given member from the given guild in the cache.

Retrieve the member for the given guild and user in the cache.

Set up the cache's Mnesia table.

Start the supervisor.

Retrieve the Mnesia table name used for the cache.

Drop the table used for caching.

Update the given member for the given guild in the cache.

Wrap long-running queries in a transaction.

Functions

bulk_create(guild_id, members)

(since 0.8.0)

Bulk create a chunk of members for the given guild in the cache.

by_guild(guild_id)

(since 0.10.0)

Stream all members on the given guild.

by_user(user_id)

(since 0.10.0)

Stream all members with the given user ID.

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(guild_id, payload)

(since 0.8.0)

Add the given member to the given guild in the cache.

delete(guild_id, user_id)

(since 0.8.0)

Remove the given member from the given guild in the cache.

get(guild_id, user_id)

(since 0.8.0)

Retrieve the member for the given guild and user in the cache.

init(opts)

(since 0.8.0)

Set up the cache's Mnesia table.

start_link(opts)

(since 0.8.0)

Start the supervisor.

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(guild_id, payload)

(since 0.8.0)

Update the given member for the given guild in the cache.

wrap_query(fun)

(since 0.10.0)

Wrap long-running queries in a transaction.