Exredis
Redis client for Elixir
Summary
query(client, command) | Performs a query with the given arguments on the connected |
query_pipe(client, command) | Performs a pipeline query, executing the list of commands |
start(host \\ "127.0.0.1", port \\ 6379, database \\ 0, password \\ "", reconnect_sleep \\ :no_reconnect) | Connects to the Redis server: |
start_link(host \\ "127.0.0.1", port \\ 6379, database \\ 0, password \\ "", reconnect_sleep \\ :no_reconnect) | Connects to the Redis server, Erlang way: |
start_using_connection_string(connection_string, reconnect_sleep \\ :no_reconnect) | Connects to the Redis server using a connection string: |
stop(client) | Disconnects from the Redis server: |
Functions
Specs:
- query(pid, list) :: any
Performs a query with the given arguments on the connected client
.
query(client, ["SET", "foo", "bar"])
query(client, ["GET", "foo"])
query(client, ["MSET" | ["k1", "v1", "k2", "v2", "k3", "v3"]])
query(client, ["MGET" | ["k1", "k2", "k3"]])
See all the available commands in the official Redis documentation.
Specs:
- query_pipe(pid, [list]) :: any
Performs a pipeline query, executing the list of commands.
query_pipe(client, [["SET", :a, "1"],
["LPUSH", :b, "3"],
["LPUSH", :b, "2"]])
Specs:
- start(binary, integer, integer, binary, :no_reconnect | integer) :: pid
Connects to the Redis server:
start
start("127.0.0.1", 6379)
Returns the pid of the connected client.
Specs:
- start_link(binary, integer, integer, binary, reconnect_sleep) :: start_link
Connects to the Redis server, Erlang way:
start_link
start_link("127.0.0.1", 6379)
Returns a tuple {:ok, pid}
.
Specs:
- start_using_connection_string(binary, :no_reconnect | integer) :: pid
Connects to the Redis server using a connection string:
start_using_connection_string("redis://user:password@127.0.0.1:6379/0")
start_using_connection_string("redis://127.0.0.1:6379")
Returns the pid of the connected client.