2808 explained code solutions for 75 technologies


lua-redisAppend value to list using lpush


local redis = (require 'redis').connect('127.0.0.1', 6379)
redis:lpush('list_key', 'val')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

lpush

appends value to the end of the Redis list

list_key

key of the list

'val'

value to append


Usage example

local redis = (require 'redis').connect('127.0.0.1', 6379)
redis:lpush('list3', 'a')
redis:lpush('list3', 'b')
local list = redis:lrange('list3', 0, 1)
print(table.concat(list, ', '))
output
b, a

link_youtube: https://youtu.be/pKfLpyhQS2k