Memcached doesn't store flags

classic Classic list List threaded Threaded
2 messages Options
Wolfram Huesken Wolfram Huesken
Reply | Threaded
Open this post in threaded view

Memcached doesn't store flags

Hello together,

Ignite's current Memcached implementation doesn't store the flags value
which comes with the set command. As Memcached can only store strings,
memcached clients usually use this as a workaround to store the datatype
and later restore the string from memcached to the original datatype.

Default is 0 which is string. This short PHP snippet (Created with
php-memcached) illustrates the bug:

== code start ==

$mc = new Memcached();
$mc->setOption(Memcached::OPT_COMPRESSION, false);
$mc->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$mc->addServer('localhost', 11211);

$stringValue = "Hallo";
$floatValue = 1.5;

printf('$stringValue is a %s%s', gettype($stringValue), PHP_EOL);
printf('$floatValue is a %s%s', gettype($floatValue), PHP_EOL);

echo PHP_EOL;

$mc->set('stringValue', $stringValue);
$mc->set('floatValue', $floatValue);

printf('$stringValue is a %s%s', gettype($mc->get('stringValue')), PHP_EOL);
printf('$floatValue is a %s%s', gettype($mc->get('floatValue')), PHP_EOL);


== code end ==

The result is:

$stringValue is a string
$floatValue is a double

$stringValue is a string
$floatValue is a string
string(5) "Hallo"
string(3) "1.5"

Is this a known bug or should I file a ticket in JIRA for this?

Mikhail Mikhail
Reply | Threaded
Open this post in threaded view

Re: Memcached doesn't store flags

Hi Wolfram,

Looks like it's broken, we parse those type bits in a request, but don't set
in for a response.
I created a ticket for this problem:


Sent from: