Hi Jeanot, I think the flush() function runs in background or in a different thread, and the variable 'Lock' getting invalidate with the flush. Maybe dormando can explain this :P

If you slow down your code, all happens normally.

$memcache = new Memcache;
$memcache->addServer('127.0.0.1', 11211);
$memcache->flush();

$time = time()+1; //one second future
while(time() < $time) {
  //sleep
}

$memcache->set('Lock', "Locked");

if ($memcache->get('Lock'))
{
echo "Lock found";
}
else
{
echo "Lock not found";
}

Feel free! Use PHP!

Marcio



Jeanot Bruchmann escreveu:
Hi there,

first, sorry for the poor english.

I hope, you can help me out with the follow problem:

PHP-Code:
$memcache = new Memcache;
$memcache->addServer('127.0.0.1', 11211);
$memcache->flush();
$memcache->set('Lock', "Locked");

if ($memcache->get('Lock'))
{
echo "Lock found";
}
else
{
echo "Lock not found";
}


Output:
Lock not found

Why???
Write PHP the Memcache after the Script has ended? Can you help me?

regards
Jeanot Bruchmann

_______________________________________
GRATIS: Movie-FLAT. Jetzt freischalten!
http://freemail.web.de/club/maxdome.htm




Reply via email to