Subject: | get_multi implementation assumes that the response keys get returned back with the same order as requests. |
Your get_multi() implementation assumes that the response keys get
returned back with the same order as requests.
This doesn't work when the server returns them in a different order.
Sample code and response in Cache::Memcached::Fast 0.16
http://subtech.g.hatena.ne.jp/mala/20090724/1248423743
I think this is not critical, but Cache::Memcached hasn't this bug.
Subject: | get_multi_order_problem.pl |
#!/usr/bin/perl
use Cache::Memcached::Fast;
use Data::Dumper;
if (my $pid = fork()) {
MyMemcached->run(port => 11212);
} else {
sleep 1;
}
my $cache = Cache::Memcached::Fast->new({
servers => ["127.0.0.1:11212"]
});
print Dumper $cache->get_multi("key1", "key2");
print Dumper $cache->get_multi("key2", "key1");
package MyMemcached;
use base qw(Net::Server);
sub process_request {
my $self = shift;
while (<STDIN>) {
s/\r?\n$//;
print "VALUE key1 0 4\r\nkey1\r\nVALUE key2 0 4\r\nkey2\r\nEND\r\n";
}
}