View Source Nostrum.Cache.MemberCache.ETS (Nostrum v0.10.0)
An ETS-based cache for members.
If you need to get the table reference for the table used by this module,
please use the table/0
function.
Summary
Functions
Bulk create a chunk of members for the given guild in the cache.
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 ETS table.
Start the supervisor.
Retrieve the ETS table reference used for the cache.
Update the given member for the given guild in the cache.
Wrap long-running queries operations.
Functions
Bulk create a chunk of members for the given guild in the cache.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec clear() :: :ok
Clear any objects in the cache.
@spec create(Nostrum.Struct.Guild.id(), map()) :: Nostrum.Struct.Guild.Member.t()
Add the given member to the given guild in the cache.
@spec delete(Nostrum.Struct.Guild.id(), Nostrum.Struct.Guild.Member.user_id()) :: {Nostrum.Struct.Guild.id(), Nostrum.Struct.Guild.Member.t()} | :noop
Remove the given member from the given guild in the cache.
@spec get(Nostrum.Struct.Guild.id(), Nostrum.Struct.Guild.Member.user_id()) :: {:ok, Nostrum.Struct.Guild.Member.t()} | {:error, any()}
Retrieve the member for the given guild and user in the cache.
Set up the cache's ETS table.
Start the supervisor.
@spec table() :: :ets.table()
Retrieve the ETS table reference used for the cache.
@spec update(Nostrum.Struct.Guild.id(), map()) :: {Nostrum.Struct.Guild.id(), Nostrum.Struct.Guild.Member.t() | nil, Nostrum.Struct.Guild.Member.t()}
Update the given member for the given guild in the cache.
@spec wrap_query((-> query_result)) :: query_result when query_result: term()
Wrap long-running queries operations.
Safety
Any operations are surrounded by :ets.safe_fixtable
. It is therefore
recommended to finish your read quickly.