[Re: PHP-Problem]

dormando dormando at rydia.net
Tue Feb 26 16:25:44 UTC 2008


The flush has a one second granularity. The flush will expire all items
up to the ones set within the same second.

-Dormando

Marcio Henrique Toloi wrote:
> 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
>>
>>
> 
> 



More information about the memcached mailing list