-
-
Save und3f/880279 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use MojoX::Redis; | |
my $redis1 = MojoX::Redis->new(); | |
$redis1->sadd("set1" => "foo")->set("foo" => "foo desc") | |
->sadd("set1" => "bar")->set("bar" => "bar desc")->quit(sub { shift->stop }) | |
->start; | |
my $redis2 = MojoX::Redis->new(); | |
$redis2->smembers( | |
"set1", | |
sub { | |
my ($redis, $res) = @_; | |
use Data::Dumper; | |
print Dumper $res; | |
my $members = @$res; | |
foreach my $e (@$res) { | |
$redis->get( | |
$e->[0] => sub { | |
printf STDERR "%s: %s\n", $e->[0], $_[1][0]; | |
$redis->stop unless --$members; | |
} | |
); | |
} | |
} | |
)->start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment