Skip to content

Instantly share code, notes, and snippets.

@moznion
Created February 11, 2017 07:46
Show Gist options
  • Save moznion/aba5a98423dd722c5e549cf66bd00895 to your computer and use it in GitHub Desktop.
Save moznion/aba5a98423dd722c5e549cf66bd00895 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use IO::Socket;
my $socket = IO::Socket::INET->new(
PeerAddr => 'localhost',
PeerPort => 11211,
Proto => 'tcp',
);
my $set = join "\r\n", map {"set $_ 0 0 1\r\nx"} 1..100;
my $get = join "\r\n", map {"get $_"} 1..100;
$socket->print("$set\r\n$get\r\nquit\r\n");
my @lines = $socket->getlines;
$socket->close;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment