Registry / storage / redis-pdel

redis-pdel

JSON →
library6.0.0jsnpmunverified

Provides a `pdel` Lua command for Redis that deletes all keys matching a given regex, designed for use with ioredis. Current version is 6.0.0, with slow release cadence. Key differentiator: it exposes raw Lua script details (name, lua, numberOfKeys) to be registered as a custom Redis command, rather than a wrapper library. Not recommended for production use; relies on SCAN and EVAL, which may block Redis. Primarily for development/testing environments.

npm install redis-pdel
INSTALL
IMPORT
SIG · REDIS-PDEL
R
redis-pdel
storagejavascriptv6.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

name
import { name } from 'redis-pdel'
const { name } = require('redis-pdel')
Package is ESM-only since v6; require() will throw. name is a string (default command name).
lua
import { lua } from 'redis-pdel'
const lua = require('redis-pdel').lua
lua is the raw Lua script string. ESM-only.
numberOfKeys
import { numberOfKeys } from 'redis-pdel'
Number of keys the command expects (0). Must be passed to defineCommand.

Registers pdel as a custom command on ioredis and deletes keys matching a pattern.

import Redis from 'ioredis'; import { name, lua, numberOfKeys } from 'redis-pdel'; const redis = new Redis(); redis.defineCommand(name, { lua, numberOfKeys }); // Usage await redis.pdel('foo:*'); // Deletes all keys matching 'foo:*'
Debug
Known issues
gotchapdel uses SCAN + EVAL which is not atomic and may block Redis in production. Intended for dev/test only.
fix
Avoid using in production; consider Redis SCAN + DEL with pagination instead.
affects: >=0.0.0
breakingPackage is now ESM-only. CommonJS require() will fail.
fix
Use import syntax or enable ESM in your project (e.g., type: 'module' in package.json or .mjs extension).
affects: >=6.0.0
deprecatedThe command name 'pdel' is the default; verify it doesn't conflict with future Redis commands.
fix
You can provide a different name to defineCommand if needed.
affects: >=0.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Package is ESM-only from v6, but being imported with require()
fix
Use `import { name, lua, numberOfKeys } from 'redis-pdel'` or set `type: 'module'` in package.json.
TypeError: redis.defineCommand is not a function
defineCommand is called on a Redis client that doesn't have that method (e.g., redis-pdel is used with node_redis instead of ioredis)
fix
Use ioredis client. redis-pdel is designed for ioredis.
ReplyError: ERR wrong number of arguments for 'pdel' command
Command expects exactly one argument (pattern), but called with none or multiple
fix
Call like: `redis.pdel('foo:*')`.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
ioredisoptionalCompanion Redis client; library exports Lua script for use with ioredis
Agent activity
27 hits · last 30 days
node
24
Amazon
1
Resources
redis-pdel — npm install redis-pdel · libregistry