Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
und3f committed Nov 2, 2011
1 parent 69421e9 commit dafa1c7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README
Expand Up @@ -38,6 +38,36 @@ SYNOPSIS
# Start IOLoop (in case it is not started yet)
$redis->start;

Create new Mojo::IOLoop instance if you need to get blocked in a
Mojolicious application.

use Mojolicious::Lite;
use MojoX::Redis;

get '/' => sub {
my $self = shift;

my $redis = MojoX::Redis->new(ioloop => Mojo::IOLoop->new);

my $value;

$redis->set(foo => 'bar')->get(
foo => sub {
my ($redis, $result) = @_;

$redis->quit->stop;

return app->log->error($redis->error) unless $result;

$value = $result->[0];
}
)->start;

$self->render(text => qq(Foo value is "$value"));
};

app->start;

DESCRIPTION
MojoX::Redis is an asynchronous client to Redis for Mojo.

Expand Down

0 comments on commit dafa1c7

Please sign in to comment.