View Source RedisPool (redis_pool_xyz v0.1.1)

A module that provides a Redis connection pool using NimblePool.

Example

iex> opts = [url: "redis://:123456@localhost:6379", pool_size: 10, name: :my_pool] iex> RedisPool.start_link(opts) iex> RedisPool.command(:my_pool, ["SET", "foo", "bar"])

iex> RedisPool.command(:my_pool, ["GET", "foo"])

Summary

Functions

delegate to Redix.command/2

delegate to Redix.pipeline/2

start redis with nimble pool

Types

@type command_t() :: [binary()]
@type pool_opts_t() ::
  keyword({:name, atom()} | {:pool_size, non_neg_integer()} | {:url, binary()})

Functions

Link to this function

command(name, command, opts \\ [])

View Source
@spec command(pid() | atom(), command_t(), keyword()) ::
  {:ok, term()} | {:error, term()}

delegate to Redix.command/2

Examples

iex> RedisPool.command(pool, ["SET", "foo", "bar"])
{:ok, "OK"}
Link to this function

pipeline(name, commands, opts \\ [])

View Source
@spec pipeline(pid() | atom(), [command_t()], keyword()) ::
  {:ok, term()} | {:error, term()}

delegate to Redix.pipeline/2

Examples

iex> RedisPool.pipeline(pool, [["SET", "foo", "bar"], ["SET", "bar", "foo"]])
{:ok, ["OK", "OK"]]}
@spec start_link(pool_opts_t()) :: GenServer.on_start()

start redis with nimble pool

Examples

iex> opts = [url: "redis://:123456@localhost:6379", pool_size: 10, name: :my_pool]
iex> RedisPool.start_link(opts)
@spec stop(pid() | atom()) :: :ok