exredis v0.3.0 Exredis View Source

Redis client for Elixir

Link to this section Summary

Functions

Performs a query with the given arguments on the connected client

Performs a query with the given arguments on the connected client

Performs a pipeline query, executing the list of commands

Performs a pipeline query with specified timeout, executing the list of commands

Connects to the Redis server, Erlang way

Allows poolboy to connect to this by passing a list of args

Disconnects from the Redis server

Link to this section Types

Link to this type reconnect_sleep() View Source
reconnect_sleep() :: :no_reconnect | integer()
Link to this type start_link() View Source
start_link() :: {:ok, pid()} | {:error, term()}

Link to this section Functions

Link to this function query(client, command) View Source
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.

Link to this function query(client, command, timeout) View Source
query(pid(), list(), Integer) :: any()

Performs a query with the given arguments on the connected client.

  • query(client, ["SET", "foo", "bar"], 100)

See all the available commands in the official Redis documentation.

Link to this function query_pipe(client, command) View Source
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"]])
Link to this function query_pipe(client, command, timeout) View Source
query_pipe(pid(), [list()], float()) :: any()

Performs a pipeline query with specified timeout, executing the list of commands

query_pipe(client, [["SET", :a, "1"], ["LPUSH", :b, "3"]], 10)
Link to this function start_link() View Source
start_link() :: start_link()
start_link() :: start_link()
start_link() :: start_link()

Connects to the Redis server, Erlang way:

  • start_link

Returns a tuple {:ok, pid}.

Allows poolboy to connect to this by passing a list of args

Link to this function start_link(host, port, database \\ 0, password \\ "", reconnect_sleep \\ :no_reconnect) View Source
start_link(binary(), integer(), integer(), binary(), reconnect_sleep()) ::
  start_link()

Connects to the Redis server, Erlang way:

  • start_link("127.0.0.1", 6379)

Returns a tuple {:ok, pid}.

Link to this function start_using_connection_string(connection_string \\ "redis://127.0.0.1:6379", reconnect_sleep \\ :no_reconnect) View Source
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.

Link to this function stop(client) View Source
stop(pid()) :: :ok

Disconnects from the Redis server:

stop client

client is a pid like the one returned by Exredis.start.