-
Notifications
You must be signed in to change notification settings - Fork 587
Using Redis
und3f edited this page Mar 26, 2011
·
7 revisions
MojoX::Redis can be used for asynchronous communication with Redis.
$redis = MojoX::Redis->new;
$redis->set(test => "test_ok")
->get(test => sub {
my ($redis, $result) = @_;
die $redis->error unless defined $result;
print qq|"result" = "|, $result->[0], qq|"\n|;
$redis->ioloop->stop;
})->start;If you planning to use MojoX::Redis in Mojolicious' daemon mode create MojoX::Redis instance with ioloop attr:
my $redis = MojoX::Redis->new(ioloop => Mojo::IOLoop->new);