本文整理汇总了PHP中Memcached::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcached::flush方法的具体用法?PHP Memcached::flush怎么用?PHP Memcached::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memcached
的用法示例。
在下文中一共展示了Memcached::flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flush
public function flush()
{
if (!$this->memcached) {
throw new CacheException('No memcached defined.');
}
$this->memcached->flush();
}
示例2: testSaveClear
public function testSaveClear()
{
$x = "valB";
$this->_adapter->saveStatus('AAA', 'BBB', $x);
$this->_connection->flush();
$this->assertEquals("", $this->_adapter->loadStatus('AAA', 'BBB'));
}
示例3: setUp
public function setUp()
{
self::$memcached->flush();
self::$memcached->quit();
$this->storage = new MemcachedStorage(self::$memcached);
$this->tokenBucket = new TokenBucket('test', $this->storage);
}
示例4: setUp
public function setUp()
{
self::$memcached->flush();
self::$memcached->quit();
self::$memcached->set('found', array('count' => 5, 'time' => strtotime('2015-01-01 00:00:00')));
self::$memcached->set('oldkey', 'old story');
$this->storage = new MemcachedStorage(self::$memcached);
}
示例5: clear
function clear()
{
$this->memcached->flush();
// $val = $this->memcached->get($key);
// if($val !== false) {
// $this->memcached->delete($key);
// }
// TODO: Implement clear() method.
}
示例6: clean
/**
* @return PeclMemcached
**/
public function clean()
{
$this->ensureTriedToConnect();
try {
$this->instance->flush();
} catch (BaseException $e) {
$this->alive = false;
}
return parent::clean();
}
示例7: setUp
public function setUp()
{
parent::setUp();
$this->memcache = new \Memcached();
$this->memcache->addServer(self::TEST_MEMCACHE_SERVER, self::TEST_MEMCACHE_PORT);
$this->memcache->flush();
if (!$this->memcache->set('test', 1, time() + 100)) {
throw new \RuntimeException('Cannot save item to memcache. ' . $this->memcache->getResultMessage());
}
}
示例8: flushAction
public function flushAction()
{
#var_dump($this->memcached->getAllKeys());
$result = $this->memcached->flush();
#var_dump($this->memcached->getAllKeys());
#die();
if (!$result) {
throw new \RuntimeException("Could not flush");
}
return $this->redirectToReferrer();
}
示例9: setUp
/**
* @inheritDoc
*/
protected function setUp()
{
parent::setUp();
/* Create the memcached client. */
$this->client = new \Memcached();
$this->client->addServer('127.0.0.1', 11211);
/* Flush the server */
$this->client->flush();
/* Create the provider instance. */
$options = array(ProviderServiceInterface::PROVIDER_OPT_PREFIX => 'my_prefix', ProviderServiceInterface::PROVIDER_OPT_SEPARATOR => ':');
$this->provider = new MemcachedProviderService($this->client, $options);
}
示例10: setUp
/**
* @requires extension memcached
*/
protected function setUp()
{
if (!extension_loaded('memcached')) {
$this->markTestSkipped('memcached extension not installed');
}
$this->memcached = new \Memcached();
$this->memcached->addServer('127.0.0.1', 11211);
$this->memcached->flush();
if (@fsockopen('127.0.0.1', 11211) === false) {
unset($this->memcached);
$this->markTestSkipped('Could not connect to Memcached instance');
}
parent::setUp();
}
示例11: setUp
protected function setUp()
{
$client = new \Memcached();
$client->addServer('localhost', 11211);
$client->flush();
$this->cache = new OffloadCacheMemcached($client);
}
示例12: internalClear
/**
* Internal method to clear items off all namespaces.
*
* @param int $normalizedMode Matching mode (Value of Adapter::MATCH_*)
* @param array $normalizedOptions
* @return boolean
* @throws Exception\ExceptionInterface
* @see clearByNamespace()
*/
protected function internalClear(&$normalizedMode, array &$normalizedOptions)
{
if (!$this->memcached->flush()) {
throw $this->getExceptionByResultCode($this->memcached->getResultCode());
}
return true;
}
示例13: flush
/**
* Flush all existing items in storage.
*
* @return boolean
*
* @since 3.6.3
*/
public function flush()
{
if (!$this->lockindex()) {
return false;
}
return static::$_db->flush();
}
示例14: flush
/**
* Flush all existing items at the server
* @return bool
*/
public function flush()
{
if ($this->enabled === false) {
return true;
}
return $this->memcached->flush();
}
示例15: getMemcached
/**
* @return \Memcached
*/
protected function getMemcached()
{
$Memcached = new \Memcached();
$Memcached->addServers($this->getTestServers());
$Memcached->flush();
return $Memcached;
}