# `BullMQ.Backends.Redis`
[🔗](https://github.com/taskforcesh/bullmq/blob/v2.2.3/lib/bullmq/backends/redis.ex#L1)

Redis implementation of the `BullMQ.Backend` behaviour.

This adapter is the Elixir port of the Node.js `RedisQueueBackend`. It is an
**immutable struct** carrying the queue identity (key `context`) and a
reference to the connection process(es) it uses:

  * `connection` — a pooled `BullMQ.RedisConnection` (a `Supervisor` +
    `NimblePool`). Commands run in the caller process via a pool checkout, so
    many operations can run concurrently without a per-backend process.
  * `blocking_conn` — an optional dedicated blocking connection (a `Redix`
    pid) used for the worker's `BZPOPMIN` and the event stream's `XREAD`,
    which must not stall pooled commands.

The adapter delegates the high-level operations to the existing
`BullMQ.Scripts` (Lua) and `BullMQ.RedisConnection` (raw command) modules, so
it is a thin translation layer: `Backend.<fn>(backend, args)` becomes
`Scripts.<fn>(backend.connection, backend.context, args)`.

# `t`

```elixir
@type t() :: %BullMQ.Backends.Redis{
  blocking_conn: pid() | nil,
  blocking_telemetry_id: term() | nil,
  client_name: String.t() | nil,
  connection: term(),
  context: BullMQ.Keys.queue_context(),
  owns_connection: boolean()
}
```

A Redis backend instance.

# `encode_job_opts`

```elixir
@spec encode_job_opts(map()) :: map()
```

Filters the job option keys that are encoded into the add scripts. Public so
callers building bulk entries can reuse the same encoding.

# `minimum_block_timeout`

The minimum meaningful blocking timeout (seconds).

# `new`

```elixir
@spec new(String.t(), keyword()) :: t()
```

Builds a Redis backend for `name`.

## Options
  * `:connection` (required) — a `BullMQ.RedisConnection` reference.
  * `:prefix` — key prefix (default `"bull"`).
  * `:blocking_conn` — an optional dedicated blocking connection pid.
  * `:client_name` — a client name set on the dedicated blocking connection
    when it is established (used for worker discovery via `CLIENT LIST`).
  * `:owns_connection` — whether `close/2` should stop the connection
    (default `true`).

---

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