May 2016
Beginner to intermediate
366 pages
8h 47m
English
We have already been using the keys and optional arguments that are accessible as the KEYS and ARGV Lua tables in our Lua server-side scripts in Redis. To illustrate this, we'll run ninth_script that echoes back a Lua table with the KEYS and ARGS variables as members to the Redis client:
>>> ninth_script = """--[[ Returns all KEYS and ARGV as members of a Lua Table ]]-- return {KEYS[1], KEYS[2], ARGV[1], ARGV[2]}""" >>> keys_and_args = ["Airline:1", "Airline:2", "Singapore Airlines", "Southwest"] >>> datastore.eval(ninth_script, 2, *keys_and_args) [b'Airline:1', b'Airline:2', b'Singapore Airlines', b'Southwest']
We can refactor this script—now called tenth_script—so that instead of requiring explicit keys for the ...
Read now
Unlock full access