Nostrum.Cache.UserCache.ETS (nostrum v0.11.0-dev)

View Source

An ETS-based cache for users.

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 list of users from upstream data.

Returns a specification to start this module under a supervisor.

Create a user from upstream data.

Retrieve a user from the cache.

Set up the ETS table.

Start the supervisor.

Retrieve the ETS table reference used for the cache.

Update a user from upstream data.

Functions

bulk_create(users)

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

Bulk create a list of users from upstream data.

child_spec(init_arg)

(since 0.5.0)

Returns a specification to start this module under a supervisor.

See Supervisor.

create(payload)

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

Create a user from upstream data.

get(id)

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

Retrieve a user from the cache.

init(opts)

(since 0.5.0)

Set up the ETS table.

start_link(opts)

(since 0.5.0)

Start the supervisor.

table()

(since 0.8.0)
@spec table() :: :ets.table()

Retrieve the ETS table reference used for the cache.

update(info)

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

Update a user from upstream data.