Scripting in Redis
Lua is a high performing scripting language with interpreter written in C. Redis provides mechanism to extend the functionality of Redis by providing support for Lua in the server side. Since Redis is implemented in C, it gives a natural synergy for Lua to be offered along with Redis as a server add on. The Lua interpreter shipped along with Redis is with limited capability and following libraries are shipped along with it:
The
base
libraryThe
table
libraryThe
string
libraryThe
math
libraryThe
debug
libraryThe
cjson
libraryThe
cmsgpack
libraryNote
Libraries which can do File I/O and Networking are not included, so you cannot send a message from LUA script in REDIS to another external system.
Before we start with fun stuff, it's always better to have a hang of the language. LUA has its own dedicated site and tons of resources are available to LUA, but the next section concentrates on just enough LUA to get started for Redis.