/** * Delete a cache entry based on id * @param string id of entry to delete * @param integer timeout of entry, if zero item is deleted immediately, otherwise the item will delete after the specified value in seconds * @return boolean */ public function delete($id, $timeout = 0) { $key = $this->_sanitize_id($id); if ($timeout == 0) { $this->_rediska->delete($key); } else { $this->_rediska->setAndExpire($key, $this->get($id), $timeout); } return true; }
public function testGC() { $this->rediska->set('s_123', 'aaa'); $this->rediska->addToSet('s_sessions', '123'); $reply = $this->saveHandler->gc(0); $this->assertTrue($reply); $values = $this->rediska->getSet('s_sessions'); $this->assertEquals(array('123'), $values); $value = $this->rediska->get('s_123'); $this->assertEquals('aaa', $value); $this->rediska->delete('s_123'); $reply = $this->saveHandler->gc(0); $this->assertTrue($reply); $values = $this->rediska->getSet('s_sessions'); $this->assertEquals(array(), $values); }
/** * Delete a queue and all of it's messages * * Returns false if the queue is not found, true if the queue exists * * @param string $name queue name * @return boolean */ public function delete($name) { if ($this->_queues->remove($name)) { if (isset($this->_queueObjects[$name])) { unset($this->_queueObjects[$name]); } return $this->_rediska->delete($this->_getKeyName("queue_{$name}")); } }
/** * Delete a cache entry based on id * @param string id of entry to delete * @param integer timeout of entry, if zero item is deleted immediately, otherwise the item will delete after the specified value in seconds * @return boolean */ public function delete($id, $timeout = 0) { $key = $this->_sanitize_id($id); if ($timeout == 0) { if (mb_substr($key, -2) == ":*") { $key = $this->_rediska->getKeysByPattern($key); } if ($key) { $this->_rediska->delete($key); } } else { $this->_rediska->setAndExpire($key, $this->get($id), $timeout); } return true; }
/** * Destroy session * * @param string $id * @return boolean */ public function destroy($id) { $this->_set->remove($id); $this->_rediska->delete($this->_getKeyName($id)); return true; }
protected function _destroy() { Cookie::delete($this->_cookie_name); return $this->_rediska->delete($this->id()); }
/** * Remove a cache record directly. This method is implemented by the cache * drivers and used in Doctrine_Cache_Driver::delete() * * @param string $id cache id * @return boolean true if no problem */ protected function _doDelete($id) { return $this->_rediska->delete($id); }
/** * @see sfCache */ public function remove($key) { return $this->_rediska->delete(array($this->getKey($key), $this->getKey($key, 'lastmodified'))); }
/** * Resets the counter for the specified subject. * * @param string $subject A unique identifier, for example a session id or an IP * @return bool */ public function reset($subject) { $keyName = $this->_getKeyName($subject); return (bool) $this->_rediska->delete($keyName); }
/** * Remove a cache record * * @param string $id Cache id * @return boolean True if no problem */ public function remove($id) { return $this->_rediska->delete($id); }
<?php set_include_path(implode(PATH_SEPARATOR, array(realpath('../library'), get_include_path()))); // STREAM print 'Benchmark stream: '; require_once 'Rediska.php'; $startTime = microtime(true); $rediska = new Rediska(array('servers' => array(array('host' => '127.0.0.1', 'port' => 6379)))); $value = str_repeat('a', 1000000); for ($i = 0; $i <= 1000; $i++) { $rediska->set('test', $value); $rediska->get('test'); $rediska->delete('test'); } $elapsedTime = microtime(true) - $startTime; print sprintf('%.4f', $elapsedTime) . "\n"; // SOCKET print 'Benchmark socket: '; $startTime = microtime(true); $rediska = new Rediska(array('servers' => array(array('host' => '127.0.0.1', 'port' => 6379, 'useSocket' => true)))); for ($i = 0; $i <= 1000; $i++) { $rediska->set('test', $value); $rediska->get('test'); $rediska->delete('test'); } $elapsedTime = microtime(true) - $startTime; print sprintf('%.4f', $elapsedTime) . "\n";