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 ==

<?php
$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);

var_dump($mc->get('stringValue'));
var_dump($mc->get('floatValue'));

== 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?

Cheers
Wolfram

Reply via email to