Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Redis scripting (LUA) for node_redis (Fork of node_redis_lua)

NotificationsYou must be signed in to change notification settings

bringr/node-redis-lua

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Patch redis script commands into node-redis prototype.

Npm

npm install redis-lua2

Usage

First attachredis-lua tonode_redis:

redis = require('redis');require('redis-lua2').attachLua(redis)

Then define some scripts (scripts may take anunlimited number of arguments):

redis.lua('myset', 'return redis.call("set", KEYS[1], KEYS[2])');

If the last parameter is set totrue the command result will be converted to a JavaScriptobject literal:

redis.lua('hashtest, 0, 'return redis.call("hgetall", "something")', true);

Finally create a redis client and call the script like a regular redis command:

r = redis.createClient();r.myset(2, 'testing', 'surprise', redis.print);

Note:2 is the number of keys that the script will receive. Arrays are also supported:

var args = ['testing', 'surprise'],   r = redis.createClient();r.myset(args.length, args, function(err, res){console.log(arguments)});

The lua script will be passed byeval the first time and subsequent calls byevalsha.

About

Redis scripting (LUA) for node_redis (Fork of node_redis_lua)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp