Add KeyDB global variable to lua api (#606)
This commit is contained in:
parent
deaaa992bd
commit
06380e5fe1
@ -1264,6 +1264,9 @@ void scriptingInit(int setup) {
|
|||||||
|
|
||||||
/* Finally set the table as 'redis' global var. */
|
/* Finally set the table as 'redis' global var. */
|
||||||
lua_setglobal(lua,"redis");
|
lua_setglobal(lua,"redis");
|
||||||
|
/* Set table as 'keydb' global var as well */
|
||||||
|
lua_getglobal(lua,"redis");
|
||||||
|
lua_setglobal(lua,"keydb");
|
||||||
|
|
||||||
/* Replace math.random and math.randomseed with our implementations. */
|
/* Replace math.random and math.randomseed with our implementations. */
|
||||||
lua_getglobal(lua,"math");
|
lua_getglobal(lua,"math");
|
||||||
|
@ -43,10 +43,15 @@ start_server {tags {"scripting"}} {
|
|||||||
r eval {return redis.call('get',KEYS[1])} 1 mykey
|
r eval {return redis.call('get',KEYS[1])} 1 mykey
|
||||||
} {myval}
|
} {myval}
|
||||||
|
|
||||||
test { EVAL - keys command works? } {
|
test {EVAL - keys command works? } {
|
||||||
r eval {return redis.call('keys', 'test')} 0
|
r eval {return redis.call('keys', 'test')} 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {EVAL - KeyDB global works } {
|
||||||
|
r eval {return keydb.call('get', KEYS[1])} 1 mykey
|
||||||
|
assert_equal [r eval {return redis.call('get',KEYS[1])} 1 mykey] [r eval {return keydb.call('get', KEYS[1])} 1 mykey]
|
||||||
|
}
|
||||||
|
|
||||||
test {EVALSHA - Can we call a SHA1 if already defined?} {
|
test {EVALSHA - Can we call a SHA1 if already defined?} {
|
||||||
r evalsha fd758d1589d044dd850a6f05d52f2eefd27f033f 1 mykey
|
r evalsha fd758d1589d044dd850a6f05d52f2eefd27f033f 1 mykey
|
||||||
} {myval}
|
} {myval}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user