9951 explained code solutions for 126 technologies


lua-redisLua and Redis usage example


local redis = (require 'redis').connect('127.0.0.1', 6379)
redis:set('k1', 'hi')
print(redis:get('k1'))ctrl + c
require 'redis'

load Redis module for Lua

connect

connect to Redis server

'127.0.0.1', 6379

Redis host and port to connect to

:set

set key value

'k1'

key name

'hi'

value to set

:get

gets value by key