redis-pdel
v5.0.1
Published
pdel lua command for redis clients
Downloads
176
Readme
redis-pdel
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:
import Redis from 'ioredis';
import { name, lua, numberOfKeys } from '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).