I am trying to build a php application using memcached on the Bluemix cloud. When adding the memcached service I get the server name, port, username and password. I installed memcached on my local server to test my application and it works:
$memcache = new Memcached();
$memcache->addServer('Server', port) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>
";
$memcache->set('val', 99);
echo $memcache->get('val');
But when I run it on Bluemix it returns the version as: 255.255.255
and doesn't read back values I store. There is username and password which I tried to add using:
$memcache->setSaslAuthData('user', 'pass');
But when I run this it, the page simply stops loading on that line.
I am new to memcached so any ideas and help will be appritiated.
The only mention of Memcached I can fin on Bluemix is a 3rd party service provided by RedisLabs.
On the HowTo Connect page, it mentions a couple of additional calls that are required:
$memcache->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
// addServer
// setSaslAuthData - that is also in your code
So, it appears that the RedisLabs may also require the use of the Memcache binary protocol as well.