Nostrum.Cache.PresenceCache (Nostrum v0.4.6) View Source
Cache for 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.
Example
info = :ets.info(:presences)
[..., heir: :none, name: :presences, size: 1, ...]
size = info[:size]
1
Link to this section Summary
Functions
Retreives a presence for a user from the cache by guild and id.
Same as get/1
, but raises Nostrum.Error.CacheError
in case of a failure.
Link to this section Functions
Specs
get(Nostrum.Struct.User.id(), Nostrum.Struct.Guild.id()) :: {:error, :presence_not_found} | {:ok, map()}
Retreives a presence for a user from the cache by guild and id.
If successful, returns {:ok, presence}
. Otherwise returns {:error, reason}
.
Example
case Nostrum.Cache.PresenceCache.get(111133335555, 222244446666) do
{:ok, presence} ->
"They're #{presence.status}"
{:error, _reason} ->
"They're dead Jim"
end
Specs
get!(Nostrum.Struct.User.id(), Nostrum.Struct.Guild.id()) :: no_return() | map()
Same as get/1
, but raises Nostrum.Error.CacheError
in case of a failure.