View Source Nostrum.Cache.PresenceCache.ETS (Nostrum v0.6.1)

ETS-based cache for user presences.

The ETS table name associated with the User Cache is presences. Besides the methods provided below you can call any other ETS methods on the table. If you need to access the name of the presence cache's table programmatically, use the tabname/0 function instead of hardcoding it in your application.

Example

info = :ets.info(presences)
[..., heir: :none, name: presences, size: 1, ...]
size = info[:size]
1

Link to this section Summary

Functions

Bulk create multiple presences in the cache.

Returns a specification to start this module under a supervisor.

Add the given presence data to the cache.

Retrieves a presence for a user from the cache by guild and id.

Set up the cache's ETS table.

Start the supervisor.

Return the ETS table name used for this cache.

Update the given presence data in the cache.

Link to this section Functions

Link to this function

bulk_create(guild_id, presences)

View Source

Specs

bulk_create(Nostrum.Struct.Guild.id(), [map()]) :: :ok

Bulk create multiple presences in the cache.

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

create(map()) :: :ok

Add the given presence data to the cache.

Specs

get(Nostrum.Struct.User.id(), Nostrum.Struct.Guild.id()) ::
  {:error, :presence_not_found} | {:ok, map()}

Retrieves a presence for a user from the cache by guild and id.

Set up the cache's ETS table.

Start the supervisor.

Specs

tabname() :: atom()

Return the ETS table name used for this cache.

Specs

update(map()) :: {Nostrum.Struct.Guild.id(), nil | map(), map()} | :noop

Update the given presence data in the cache.