php-react-memcached icon indicating copy to clipboard operation
php-react-memcached copied to clipboard

Incorrectly reads multiple value at once

Open Logioniz opened this issue 6 years ago • 0 comments

Create 3 key/value pairs to test

$ nc -C 127.0.0.1 9003
set QWE 0 0 3
QWE
STORED
set ASD 0 0 3
ASD
STORED
set ZXC 0 0 3
ZXC
STORED
gets QWE ASD ZXC
VALUE QWE 0 3 37
QWE
VALUE ASD 0 3 38
ASD
VALUE ZXC 0 3 39
ZXC
END
^C
$

Try to read all of them at once via nc

$ nc -C 127.0.0.1 9003
get QWE ASD ZXC
VALUE QWE 0 3
QWE
VALUE ASD 0 3
ASD
VALUE ZXC 0 3
ZXC
END
^C
$

Try to read all of then via script

<?php

$loader = require __DIR__ . '/vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

use \seregazhuk\React\Memcached\Factory;

$memcached = Factory::createClient($loop, '127.0.0.1:9003');
$memcached->get('QWE ASD ZXC')->then(
    function ($data) {
        echo $data;
    },
    function ($error) {
        echo $error;
    }
);

$loop->run();

We get only last value

Logioniz avatar Mar 27 '19 14:03 Logioniz