View Source Nostrum.Cache.MemberCache.ETS (Nostrum v0.7.0)

An ETS-based cache for members.

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

The default table name under which guilds are cached is nostrum_members. 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. Use the tabname/0 function for retrieving the table name at runtime.

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.MemberCache directly, which will dispatch to the configured cache.

Link to this section Summary

Functions

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

Get all members for the given user ID.

Returns a specification to start this module under a supervisor.

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

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

Get all members for a given guild ID.

Fetch a single member from the cache.

Set up the cache's ETS table.

Get a QLC handle for the entire table.

Start the supervisor.

Retrieve the ETS table name used for the cache.

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

Link to this section Functions

Link to this function

bulk_create(guild_id, members)

View Source (since 0.7.0)

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

Link to this function

by_user(user_id)

View Source (since 0.7.0)

Get all members for the given user ID.

The same implementation notes as for get/1 apply for this function.

Link to this function

child_spec(init_arg)

View Source (since 0.7.0)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

create(guild_id, payload)

View Source (since 0.7.0)

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

Link to this function

delete(guild_id, user)

View Source (since 0.7.0)

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

Link to this function

get(guild_id)

View Source (since 0.7.0)

Get all members for a given guild ID.

Note that this implementation uses :ets.safe_fixtable/2 to ensure safe traversal until the returned stream is exhausted or the calling process terminates. This also degrades performance for other table operations, and prevents table deletions from freeing up memory. It is therefore recommended to finish your business quickly.

Link to this function

get(guild_id, user_id)

View Source (since 0.7.0)

Fetch a single member from the cache.

Link to this function

init(init_arg)

View Source (since 0.7.0)

Set up the cache's ETS table.

Link to this function

qlc_handle()

View Source (since 0.7.0)
@spec qlc_handle() :: :qlc.query_handle()

Get a QLC handle for the entire table.

Link to this function

start_link(init_arg)

View Source (since 0.7.0)

Start the supervisor.

@spec tabname() :: atom()

Retrieve the ETS table name used for the cache.

Link to this function

update(guild_id, payload)

View Source (since 0.7.0)

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