Redix.command-exclamation-mark
You're seeing just the function
command-exclamation-mark
, go back to Redix module for more information.
Specs
command!(connection(), command(), keyword()) :: Redix.Protocol.redis_value()
Issues a command on the Redis server, raising if there's an error.
This function works exactly like command/3
but:
- if the command is successful, then the result is returned directly (not wrapped in a
{:ok, result}
tuple). - if there's a Redis error or a connection error, a
Redix.Error
orRedix.ConnectionError
error is raised.
This function accepts the same options as command/3
.
Examples
iex> Redix.command!(conn, ["SET", "mykey", "foo"])
"OK"
iex> Redix.command!(conn, ["INCR", "mykey"])
** (Redix.Error) ERR value is not an integer or out of range
If Redis goes down (before a reconnection happens):
iex> Redix.command!(conn, ["GET", "mykey"])
** (Redix.ConnectionError) :closed