Skip to content

Instantly share code, notes, and snippets.

@moznion
Created February 11, 2017 03:39
Show Gist options
  • Select an option

  • Save moznion/3ec337a06dc0c6df745b33e241fe8a52 to your computer and use it in GitHub Desktop.

Select an option

Save moznion/3ec337a06dc0c6df745b33e241fe8a52 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Cache::Memcached::Fast;
use Parallel::ForkManager;
my $memd = Cache::Memcached::Fast->new({
servers => ['127.0.0.1:11211'],
});
my @keys = map {$_} (1..10000);
for my $key (@keys) {
$memd->set($key, 'xxxx' x 1024);
}
my $pm = Parallel::ForkManager->new(25);
while(1) {
my $pid = $pm->start and next;
my $memd = new Cache::Memcached::Fast({
servers => ['127.0.0.1:11211'],
});
$memd->get_multi(@keys) for 1..5;
$pm->finish;
}
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment