9951 explained code solutions for 126 technologies


python-redisUsing Redis eval


r = redis.Redis()
val = r.eval("return redis.call('get', 'test')", 0)ctrl + c
redis.Redis

connect to Redis server

eval

executes Lua script

"return redis.call('get', 'test')"

sample Lua script to execute (returns value of test key from Redis)

, 0)

need to use this zero so Redis will not wait any additional data from us ("required shit")

val =

variable will contain returned data from Lua script