delete() public method

Delete a key.
See also: Memcache::delete()
public delete ( string $key, integer $timeout ) : boolean
$key string The key.
$timeout integer Expiration time in seconds.
return boolean True on success.
Example #1
0
 /**
  */
 protected function _delete($keys)
 {
     $ret = true;
     foreach ($keys as $val) {
         if (!$this->_memcache->delete($val)) {
             $ret = false;
         }
     }
     return $ret;
 }
Example #2
0
 /**
  */
 public function expire($key)
 {
     $key = $this->_params['prefix'] . $key;
     unset($this->_expirecache[$key]);
     $this->_memcache->delete($key . '_e');
     return $this->_memcache->delete($key);
 }
Example #3
0
 /**
  */
 public function expire($key)
 {
     $key = $this->_params['prefix'] . $key;
     $this->_objectcache[$key] = false;
     $this->_memcache->delete($key . '_e');
     return $this->_memcache->delete($key);
 }
Example #4
0
 public static function setUpBeforeClass()
 {
     if (!extension_loaded('memcache')) {
         self::$reason = 'No memcache extension.';
         return;
     }
     $config = self::getConfig('SESSIONHANDLER_MEMCACHE_TEST_CONFIG', dirname(__FILE__) . '/..');
     if (!$config || empty($config['sessionhandler']['memcache'])) {
         self::$reason = 'No memcache configuration.';
         return;
     }
     $memcache = new Horde_Memcache($config['sessionhandler']['memcache']);
     $memcache->delete('sessionid');
     $memcache->delete('sessionid2');
     self::$handler = new Horde_SessionHandler_Storage_Memcache(array('memcache' => $memcache, 'track' => true));
     parent::setUpBeforeClass();
 }
Example #5
0
 /**
  */
 public function destroy($id)
 {
     $result = $this->_memcache->delete($id);
     $this->_memcache->unlock($id);
     if ($result === false) {
         return false;
     }
     if (!empty($this->_params['track'])) {
         $this->_memcache->lock($this->_trackID);
         $ids = $this->_memcache->get($this->_trackID);
         if ($ids !== false) {
             unset($ids[$id]);
             $this->_memcache->set($this->_trackID, $ids);
         }
         $this->_memcache->unlock($this->_trackID);
     }
     return true;
 }