redis-pdel

pdel lua command for redis clients

Usage no npm install needed!

<script type="module">
  import redisPdel from 'https://cdn.skypack.dev/redis-pdel';
</script>

README

redis-pdel

Travis npm package Dependency Status devDependency Status

pdel lua command for redis clients

pdel redis command

Deletes all the keys matching a specific regex, for example

set foo:one val
set foo:two val
pdel foo:*
get foo:one <- nil
get foo:two <- nil

Note: this is not meant to be used in production. Supports Node 4+.

Install

$ npm install --save redis-pdel

Usage

The easiest usecase is to use with https://github.com/luin/ioredis as follows:

const Redis = require('ioredis');
const { name, lua, numberOfKeys } = require('redis-pdel');
const redis = new Redis();
redis.defineCommand(name, { lua, numberOfKeys });

Then, just run like any other command:

redis.pdel('foo:*');

Tests

There are unit tests and integration tests. The integration tests require redis to be running.

docker-compose up
npm test:unit
npm test:integration
npm test # run both tests

License

See the LICENSE file for license rights and limitations (MIT).