del('lock::' . $key); } /* lock */ else { # si on l'a deja, ok if (isset($locks[$key])){ return true; } # sinon s'il existe, on attend qu'il se libere $wait = 0; while ($this->exists('lock::' . $key)){ if ($wait++<_LOCK_MAX){ sleep(1); } else { return false; } } # ... puis on le pose if ($this->inc('lock::' . $key, 1, _LOCK_MAX)<=1){ $locks[$key] = true; register_shutdown_function(array($this, 'unlock'), $key); return true; } return false; } } public function unlock($key){ $this->lock($key, true); } public function size(){ # necessite xcache.admin.user #$a = xcache_list(); #var_dump($a); return false; } public function purge(){ return false; } }