View Source Nostrum.Cache.UserCache.ETS (Nostrum v0.7.0-rc1)

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.

Get a QLC handle for the backing table.

Start the supervisor.

Retrieve the ETS table name used for the cache.

Update a user from upstream data.

Link to this section Functions

Link to this function

bulk_create(users)

View Source (since 0.5.0)
@spec bulk_create(Enum.t()) :: :ok

Bulk create a list of users from upstream data.

Link to this function

child_spec(init_arg)

View Source (since 0.5.0)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

create(user)

View Source (since 0.5.0)
@spec create(map()) :: Nostrum.Struct.User.t()

Create a user from upstream data.

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

Get a user by ID.

Link to this function

init(init_arg)

View Source (since 0.5.0)

Set up the 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 backing table.

Link to this function

start_link(init_arg)

View Source (since 0.5.0)

Start the supervisor.

@spec tabname() :: atom()

Retrieve the ETS table name used for the cache.

Link to this function

update(info)

View Source (since 0.5.0)
@spec update(map()) :: {Nostrum.Struct.User.t(), Nostrum.Struct.User.t()} | :noop

Update a user from upstream data.