NAME

Queue::Q::ReliableFIFO::Lua - Load lua scripts into Redis

SYNOPSIS

use Queue::Q::ReliableFIFO::Lua;
my $lua = Queue::Q::ReliableFIFO::Lua->new(
  script_dir => /some/path
  redis_conn => $redis_conn);

$lua->call('myscript', $n, @keys, @argv);

DESCRIPTION

This module offers two ways of loading/running Lua scripts.

One way is with separate Lua scripts, which live at a location as indicated by the script_dir parameter (passed to the constructor) or as indicated by the LUA_SCRIPT_DIR environment variable.

The other way is by putting the source code of the Lua scripts in this module, in the %Scripts hash.

Which way is actually used depends on whether or not passing info about a path to Lua scripts. If a Lua script location is known, those script will be used, otherwise the %Scripts code is used.

During development it is more convenient to use the separate Lua files of course. But for deploying it is less error prone if the Lua code is inside the Perl module. So that is why this is done this way.

The scripts are loaded when the constructor is called.