# `OpenrelikWorkerCommon.MountUtils.RedisLock`
[🔗](https://github.com/hacktobeer/openrelik-worker-common-elixir/blob/v0.1.0/lib/openrelik_worker_common/mount_utils.ex#L15)

Distributed Redis lock for NBD device coordination across containers/nodes,
matching Python `redis.lock.Lock` (`name`, `timeout`, `token`, `acquire/1`, `release/1`).

# `t`

```elixir
@type t() :: %OpenrelikWorkerCommon.MountUtils.RedisLock{
  client: term(),
  name: String.t(),
  timeout: pos_integer(),
  token: String.t()
}
```

# `acquire`

```elixir
@spec acquire(t()) :: boolean()
```

Attempts to acquire the Redis lock non-blockingly (`SET name token NX EX timeout`).

# `new`

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

Creates a new `RedisLock` struct.

# `release`

```elixir
@spec release(t()) :: :ok
```

Releases the Redis lock if still owned by `token`.

---

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