# `Redis.Connection.Pool`
[🔗](https://github.com/joshrotenberg/redis_ex/blob/v0.7.1/lib/redis/connection/pool.ex#L1)

Connection pool for Redis.

Manages N `Redis.Connection` processes with round-robin dispatch.
Dead connections are automatically replaced. Same API as a single connection.

## Usage

    {:ok, pool} = Redis.Connection.Pool.start_link(
      pool_size: 5,
      host: "localhost",
      port: 6379
    )

    {:ok, "OK"} = Redis.Connection.Pool.command(pool, ["SET", "key", "val"])
    {:ok, "val"} = Redis.Connection.Pool.command(pool, ["GET", "key"])

## Options

  * `:pool_size` - number of connections (default: 5)
  * `:strategy` - `:round_robin` or `:random` (default: `:round_robin`)
  * `:name` - GenServer name
  * All other options are passed to each `Redis.Connection`

## Supervision

    children = [
      {Redis.Connection.Pool, pool_size: 10, port: 6379, name: :redis_pool}
    ]

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `command`

```elixir
@spec command(GenServer.server(), [String.t()], keyword()) ::
  {:ok, term()} | {:error, term()}
```

# `info`

```elixir
@spec info(GenServer.server()) :: map()
```

Returns pool info: size, active connections, strategy.

# `noreply_command`

```elixir
@spec noreply_command(GenServer.server(), [String.t()], keyword()) ::
  :ok | {:error, term()}
```

# `noreply_pipeline`

```elixir
@spec noreply_pipeline(GenServer.server(), [[String.t()]], keyword()) ::
  :ok | {:error, term()}
```

# `pipeline`

```elixir
@spec pipeline(GenServer.server(), [[String.t()]], keyword()) ::
  {:ok, [term()]} | {:error, term()}
```

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

# `stop`

```elixir
@spec stop(GenServer.server()) :: :ok
```

# `transaction`

```elixir
@spec transaction(GenServer.server(), [[String.t()]], keyword()) ::
  {:ok, [term()]} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
