/usr/share/doc/libkyototycoon2/example/ktmemcfastex.pl is in kyototycoon-doc 0.9.56-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | use strict;
use warnings;
use Cache::Memcached::Fast;
my $servers = [{
address => "127.0.0.1:11211",
noreply => 1,
}];
printf("connecting...\n");
my $cache = Cache::Memcached::Fast->new({ servers => $servers });
if (!defined($cache)) {
printf("new failed\n");
}
printf("checking the version...\n");
my $versions = $cache->server_versions();
while (my ($server, $version) = each(%$versions)) {
printf("versions: %s: %s\n", $server, $version);
}
printf("flusing...\n");
if (!$cache->flush_all()) {
printf("flush_all failed\n");
}
printf("flusing without reply...\n");
$cache->flush_all();
printf("setting...\n");
for (my $i = 1; $i <= 10; $i++) {
if (!$cache->set($i, $i)) {
printf("set failed\n");
}
}
printf("incrementing...\n");
for (my $i = 1; $i <= 10; $i++) {
if (!defined($cache->incr($i, 10000))) {
printf("incr failed\n");
}
if (!defined($cache->decr($i, 1000))) {
printf("decr failed\n");
}
}
printf("retrieving...\n");
for (my $i = 1; $i <= 10; $i++) {
my $value = $cache->get($i);
printf("get: %s: %s\n", $i, $value);
}
printf("removing...\n");
for (my $i = 1; $i <= 10; $i++) {
if (!$cache->remove($i)) {
printf("remove failed\n");
}
}
printf("setting without reply...\n");
for (my $i = 1; $i <= 10; $i++) {
$cache->set($i, $i);
}
printf("incrementing without reply...\n");
for (my $i = 1; $i <= 10; $i++) {
$cache->incr($i, 1000);
}
printf("retrieving in bulk...\n");
my $values = $cache->get_multi(1..10);
while (my ($key, $value) = each(%$values)) {
printf("get_multi: %s: %s\n", $key, $value);
}
printf("removing without reply...\n");
for (my $i = 1; $i <= 10; $i++) {
$cache->delete($i);
}
printf("disconnecting...\n");
$cache->disconnect_all();
|