Advanced Lua scripting with Redis
Now that we have a basic understanding of Lua scripting in Redis, we will see how we might refactor a few examples from the previous chapters to use Lua scripts. We'll also note potential problems that might occur while using Lua scripting including introducing hidden complexities and harmful performance implications of these changes. Lua scripting is a valuable tool, but must be used in the context of its limitations with server-side scripts in Redis.
In Chapter 3, Managing RAM: Tips and Techniques for Redis Memory Management, we will modified our tea and coffee Python code to use Lua scripts for bitmap operations, and finally, in Chapter 4, Programming Redis Part One: Redis Core, Clients, and Languages, we modified both the linked data fragments as well as our Node.js applications to use Lua scripts.
MARC21 ingestion
From our first chapter example of ingesting the MARC21
records into a Redis key schema structure, we'll use a loaded Lua script....