Skip to content

Instantly share code, notes, and snippets.

@ichirin2501 ichirin2501/rr.pl Secret
Created Jul 2, 2016

Embed
What would you like to do?
use strict;
use warnings;
use Redis::Fast;
use Getopt::Long qw/:config posix_default no_ignore_case bundling auto_help/;
GetOptions(
\my %opt, qw/
c=i
/) or pod2usage(1);
srand(time);
my $redis = Redis::Fast->new;
my $size = $opt{c} // 1000;
my @buf = ();
for my $i (1..($size)) {
my $member = sprintf "m:%d", int(rand(100000000) + 1);
if (@buf > 10000) {
$redis->zadd("zsettest", @buf, sub {});
@buf = ();
}
push @buf, ($i, $member);
}
if (@buf) {
$redis->zadd("zsettest", @buf, sub {});
@buf = ();
}
$redis->wait_all_responses;
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.