# @medusajs/locking-redis

> Redis Lock for Medusa

Latest version **2.22.6** (published 2026-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @medusajs/locking-redis
pnpm add @medusajs/locking-redis
yarn add @medusajs/locking-redis
bun add @medusajs/locking-redis
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score; popular repo.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 2.22.6 |
| Published | 2026-11-09 |
| First published | 2024-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=22.22.0 |
| Dependencies | 1 |
| Unpacked size | 39.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 36596 |
| Author | Medusa |
| Maintainers | sebrindom, nicolas-gorga, sradevski, olijuhl, shahednasser |
| Keywords | medusa-providers, medusa-providers-locking |

## Links

- npm: https://www.npmjs.com/package/@medusajs/locking-redis
- Repository: https://github.com/medusajs/medusa
- Homepage: https://github.com/medusajs/medusa#readme
- Issues: https://github.com/medusajs/medusa/issues
- npm.io page: https://npm.io/package/@medusajs/locking-redis

## Dependencies (1)

- [ioredis](https://npm.io/package/ioredis.md) ^5.11.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.22.6 (latest) — 2026-11-09
- 2.22.7-snapshot-20261112111749 (snapshot) — 2026-11-12
- 2.22.4-preview-20261106081111 (preview) — 2026-11-06
- 2.16.0-options-preview-20260605124754 (options-preview) — 2026-06-05
- 2.0.0-rc-20241022183311 (rc) — 2024-10-22
- 2.22.7-snapshot-20261111153147 — 2026-11-11
- 2.22.5 — 2026-11-09
- 2.22.4 — 2026-11-06
- 2.22.3 — 2026-11-04
- 2.22.3-snapshot-20261103230838 — 2026-11-03
- 2.22.3-snapshot-20261030141225 — 2026-10-30
- 2.22.2 — 2026-10-30
- 2.22.2-preview-20261029142542 — 2026-10-29
- 2.22.2-preview-20261029135257 — 2026-10-29
- 2.22.2-preview-20261028132907 — 2026-10-28
- … 179 more at https://npm.io/package/@medusajs/locking-redis/versions

## README

<p align="center">
  <a href="https://www.medusajs.com">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/59018053/229103275-b5e482bb-4601-46e6-8142-244f531cebdb.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
    <img alt="Medusa logo" src="https://user-images.githubusercontent.com/59018053/229103726-e5b529a3-9b3f-4970-8a1f-c6af37f087bf.svg">
    </picture>
  </a>
</p>
<h1 align="center">
  @medusajs/locking-redis
</h1>

<h4 align="center">
  <a href="https://docs.medusajs.com">Documentation</a> |
  <a href="https://www.medusajs.com">Website</a>
</h4>

<p align="center">
  Building blocks for digital commerce
</p>
<p align="center">
  <a href="https://github.com/medusajs/medusa/blob/develop/LICENSE">
    <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Medusa is released under the MIT license." />
  </a>
  <a href="https://github.com/medusajs/medusa/blob/develop/CONTRIBUTING.md">
    <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" alt="PRs welcome!" />
  </a>
  <a href="https://discord.gg/xpCwq3Kfn8">
    <img src="https://img.shields.io/badge/chat-on%20discord-7289DA.svg" alt="Discord Chat" />
  </a>
  <a href="https://twitter.com/intent/follow?screen_name=medusajs">
    <img src="https://img.shields.io/twitter/follow/medusajs.svg?label=Follow%20@medusajs" alt="Follow @medusajs" />
  </a>
</p>

Redis Locking Module Provider for Medusa: implements the Locking Module's locks in Redis, so locks are shared across all Medusa instances. It's the recommended locking provider for production. It ships with `@medusajs/medusa` and is registered through the `@medusajs/medusa/locking-redis` path.

## At a glance

| | |
| --- | --- |
| Package | `@medusajs/locking-redis` |
| Type | Module Provider (Locking Module) |
| Provider ID | `locking-redis` |
| Registered by default | No (on Medusa Cloud, registered as the default when `REDIS_URL` is set) |
| Import from | `@medusajs/medusa/locking-redis` |

## Installation

No installation needed. The provider is a dependency of `@medusajs/medusa`. You need a running Redis server.

## Usage

Register the provider in the Locking Module's `providers` array in `medusa-config.ts`:

```ts
import { defineConfig } from "@medusajs/framework/utils"

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/medusa/locking",
      options: {
        providers: [
          {
            resolve: "@medusajs/medusa/locking-redis",
            id: "locking-redis",
            // makes this the default locking provider
            is_default: true,
            options: {
              redisUrl: process.env.LOCKING_REDIS_URL,
            },
          },
        ],
      },
    },
  ],
})
```

## Configuration

| Option | Type | Description | Default |
| --- | --- | --- | --- |
| `redisUrl` | `string` | Required. The Redis connection URL. | - |
| `redisOptions` | `RedisOptions` | Options passed to the `ioredis` client. | - |
| `namespace` | `string` | Prefix for lock keys. | `"medusa_lock:"` |
| `waitLockingTimeout` | `number` | Default time to wait to acquire a lock, in seconds. | `5` |
| `defaultRetryInterval` | `number` | Initial interval between lock attempts, in milliseconds. | `20` |
| `maximumRetryInterval` | `number` | Maximum interval between lock attempts, in milliseconds. | `1000` |
| `backoffFactor` | `number` | Multiplier applied to the retry interval after each attempt. | `2` |

| Environment variable | Description |
| --- | --- |
| `LOCKING_REDIS_URL` | Value for `redisUrl`, as used in the example above. |
| `REDIS_URL` | On Medusa Cloud, `defineConfig` registers this provider as the default with this URL. |

## Resources

- [Redis Locking Module Provider](https://docs.medusajs.com/resources/infrastructure-modules/locking/redis)
- [Locking Module](https://docs.medusajs.com/resources/infrastructure-modules/locking)

---
_Source: https://npm.io/package/@medusajs/locking-redis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
