I stumbled upon a weird behavior of Memcached server (version 1.4.5):
I have a single server and I’m trying to delete a stored value and it doesn’t work as the item remains there (and I don’t receive any error).
I wrote a quick PHP code that shows the problem:
$memcache_object = memcache_connect(MEMCACHED_SERVER_ADDRESS, MEMCACHED_SERVER_PORT);
$key = '64b788714dx7cds5350101e37ec0ddd40253123d';
$myObject = memcache_get($memcache_object, $key);
echo count($myObject); // Prints 1000
memcache_delete($memcache_object, $key);
$myObjectSecondTry = memcache_get($memcache_object, $key);
if (empty($myObjectSecondTry))
echo 'Empty'; // It does print it's empty
memcache_close($memcache_object);
Now if I run the code once it says “1000” and also it says that the object was empty on the second memcache_get() try.
But if I click refresh and run it again then the $key still exists on the memcached server and I get the same output.
I also tried to reconnect between each memcache call (i.e. get->delete->get) but it didn’t help.
The only thing that clears the memory is reseting the Memcached service.
Please advise.
As far as I remember, it was an issue with the timeout so can you please try to use: