Horde_Memcache::unlock PHP Method

unlock() public method

Release lock on a key.
public unlock ( string $key )
$key string The key to lock.
    public function unlock($key)
    {
        $this->_memcache->delete($this->_key($key . self::LOCK_SUFFIX), 0);
        unset($this->_locks[$key]);
    }

Usage Example

示例#1
0
文件: Memcache.php 项目: horde/horde
 /**
  * Do garbage collection for session tracking information.
  */
 public function trackGC()
 {
     $this->_memcache->lock($this->_trackID);
     $ids = $this->_memcache->get($this->_trackID);
     if (empty($ids)) {
         $this->_memcache->unlock($this->_trackID);
         return;
     }
     $tstamp = time() - $this->_params['track_lifetime'];
     $alter = false;
     foreach ($ids as $key => $val) {
         if ($tstamp > $val) {
             unset($ids[$key]);
             $alter = true;
         }
     }
     if ($alter) {
         $this->_memcache->set($this->_trackID, $ids);
     }
     $this->_memcache->unlock($this->_trackID);
 }
All Usage Examples Of Horde_Memcache::unlock