0.0.1 • Published 3 years ago

js-redis-script v0.0.1

Weekly downloads
44
License
MIT
Repository
github
Last release
3 years ago

js-redis-script

Build Status Coverage Status

Redis script runner. It optimistically uses EVALSHA to run the script. If script does not exist it retries using EVAL.

Example usage:

import { createClient } from 'redis';
import { RedisScript } from '..';

async function main() {
    const client = createClient();
    const script = new RedisScript({
        client,
        src: 'return redis.call("ping")'
    });

    const res = await script.run(0);
    console.log('PING', res);
    // Output:
    // PING PONG

    client.quit();
}

main().catch((err) => {
    console.error(err);
    process.exit(1);
});