, queue_name => 'other_queue'
);
# Producer:
$q->enqueue_item("foo");
# You can pass any JSON-serializable data structure
$q->enqueue_item({ bar => "baz" });
$q->enqueue_item({ id=> 12},{
> are serialized
using JSON (cf. L<JSON::XS>), so
any data structures supported by that can be enqueued.
We use JSON because that is supported at the Lua side as well (the cjson
library).
The impleme
ing, JSON is easier, while Sereal::* is
# faster (about 7%) and delivers smaller serialized blobs.
use JSON::XS; # use the real stuff, no fall back on pure Perl JSON please
my $serializer = JSON::XS
->new->utf8->pretty(0);
my $deserializer = JSON::XS->new->utf8->pretty(0);
#use Sereal::Encoder;
#use Sereal::Decoder;
#my $serializer = Sereal::Encoder->new();
#my $deserializer = Sereal::Decoder-
age Queue::Q::ReliableFIFO::CLI;
use strict;
use Redis;
use Term::ReadLine;
use Data::Dumper;
use JSON::XS;
use File::Slurp;
use Carp qw(croak);
use Queue::Q::ReliableFIFO::Redis;
use Class::XSAccess
my %conf;
if (!$params{ignore_config_file} and -f $conf_file) {
%conf = %{decode_json(read_file($conf_file))};
$self->open(server => $conf{server}, port => $conf{port})
$self->path;
}
$conf{history} = \@history;
write_file($conf_file, encode_json(\%conf));
exit 0;
};
my %commands = map { $_ => undef } (qw(
open