Comment 0 for bug 1201300

Revision history for this message
Tarun Chabarwal (tarunchabarwal) wrote :

I'm using php with memcached 2.1, libmemcached 1.0.16 and memcache server 1.4

I wrote the following script, which results in some key persistance

<?php
class mem{
        public $mem = null;
        public static $x = 0;

        public function __construct()
        {
                $this->mem = new Memcached();
                $this->mem->addServer("localhost",11211);
                $op = $this->mem->add("key_".self::$x, "test");
        }
        public function __destruct()
        {
                $op = $this->mem->delete("key_".self::$x);
                $this->mem = null;
                self::$x++;
        }
}
for($i=0;$i<100000;$i++){
$v = new mem();
}

When this script runs, I found that 5-10 keys were not being deleted and when i run the same script with memcached 2.0, libmemcached 0.48, keeping the same memcache server every key is deleted

I watched the memcached library code but didn't find much difference. I think it has to do some with libmemcached....

Please give me some explanation for this behavior