js-redis-script
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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);
});

Readme

Keywords

Package Sidebar

Install

npm i js-redis-script

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

5.44 kB

Total Files

7

Last publish

Collaborators

  • da440dil