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

An ETS-based cache for users.

The default table name under which users are cached is nostrum_users. 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.

Link to this section Summary

Functions

Bulk create a list of users from upstream data.

Returns a specification to start this module under a supervisor.

Create a user from upstream data.

Get a user by ID.

Set up the ETS table.

Start the supervisor.

Retrieve the ETS table name used for the cache.

Update a user from upstream data.

Link to this section Functions

Specs

bulk_create(Enum.t()) :: :ok

Bulk create a list of users from upstream data.

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

create(map()) :: Nostrum.Struct.User.t()

Create a user from upstream data.

Specs

get(Nostrum.Struct.User.id()) ::
  {:ok, Nostrum.Struct.User.t()} | {:error, atom()}

Get a user by ID.

Set up the ETS table.

Start the supervisor.

Specs

tabname() :: atom()

Retrieve the ETS table name used for the cache.

Specs

update(map()) :: {Nostrum.Struct.User.t(), Nostrum.Struct.User.t()} | :noop

Update a user from upstream data.