0.0.2 • Published 10 years ago

arth-redis-lua v0.0.2

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

Build Status NPM version

redis-lua-helper

Lua scripts helper for RedisClient

Install

npm install redis-lua-loader

##Usage:

  var Lua = require('redis-lua-loader');
  //create helper and link to RedisClient
  client.lua = new Lua(client);
  //flush all lua scripts
  client.lua.flush();
  //load new script
  client.lua.load('some script', 'return {KEYS[1], ARGV[1]+ARGV[2]+ARGV[3]}');
  //run lua script(waitRun will wait when script will be loaded)
  client.lua.waitRun('some script',{
    keys: ['key1'],
    argv: [1,2,3]
  }, function(err, res){
    console.log(res);// ['key1', 6]
  })