EDA.Cache.User (EDA v0.3.0)

Copy Markdown View Source

ETS-based cache for Discord users.

Provides O(1) lookups for user data.

Summary

Functions

Gets all cached users.

Returns a specification to start this module under a supervisor.

Returns the number of cached users.

Creates or replaces a user in the cache.

Deletes a user from the cache.

Gets a user from the cache.

Updates a user in the cache.

Functions

all()

@spec all() :: [map()]

Gets all cached users.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count()

@spec count() :: non_neg_integer()

Returns the number of cached users.

create(user)

@spec create(map()) :: map()

Creates or replaces a user in the cache.

delete(user_id)

@spec delete(String.t() | integer()) :: :ok

Deletes a user from the cache.

get(user_id)

@spec get(String.t() | integer()) :: map() | nil

Gets a user from the cache.

start_link(opts)

update(user_id, updates)

@spec update(String.t() | integer(), map()) :: map() | nil

Updates a user in the cache.