本文整理汇总了PHP中Memcache::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP Memcache::flush方法的具体用法?PHP Memcache::flush怎么用?PHP Memcache::flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Memcache
的用法示例。
在下文中一共展示了Memcache::flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
\Gacela\Gacela::reset();
if (is_object($this->memcache)) {
$this->memcache->flush();
}
}
示例2: DeleteAll
/**
* Invalidate all the objects in the cache
* @return void
*/
public function DeleteAll()
{
$this->objMemcache->flush();
// needs to wait one second after flush.
// See comment on http://www.php.net/manual/ru/memcache.flush.php#81420
sleep(1);
}
示例3: deleteAll
function deleteAll()
{
if (null === $this->memcache) {
$this->connect();
}
$this->memcache->flush();
}
示例4: clean
/**
* @return PeclMemcache
**/
public function clean()
{
try {
$this->instance->flush();
} catch (BaseException $e) {
$this->alive = false;
}
return parent::clean();
}
示例5: checkCache
function checkCache($check = 0, $in, $out, $set = 0)
{
$inOut = 'inOut_' . $in . '_' . $out;
$memcache_obj = new Memcache();
$memcache_obj->connect('127.0.0.1', 11211) or die("Could not connect");
if ($check === 1) {
$available = $memcache_obj->get($inOut);
if (!$available) {
$set = $this->superfastCheck(1, $in, $out);
$memcache_obj->set($inOut, $set, false, 324);
$available = $memcache_obj->get($inOut);
}
} elseif ($check === 2) {
$memcache_obj->flush();
} else {
$set = $this->superfastCheck($in, $out);
//var_dump($set);
$memcache_obj->set($inOut, $set, false, 324);
//echo $inOut;
$available = $memcache_obj->get($inOut);
//var_dump($memcache_obj->getStats());
}
//var_dump($available);
$memcache_obj->close();
return $available;
}
示例6: setUp
protected function setUp()
{
parent::setUp();
if (\extension_loaded('memcache') && @fsockopen('localhost', 11211)) {
$memcache = new \Memcache();
$memcache->addServer('localhost');
$memcache->flush();
$cacheDriver = new \Doctrine\Common\Cache\MemcacheCache();
$cacheDriver->setMemcache($memcache);
$this->_em->getMetadataFactory()->setCacheDriver($cacheDriver);
} else {
if (\extension_loaded('apc')) {
$this->_em->getMetadataFactory()->setCacheDriver(new \Doctrine\Common\Cache\ApcCache());
} else {
$this->markTestSkipped('Test only works with a cache enabled.');
}
}
try {
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC742User'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC742Comment')));
} catch (\Exception $e) {
}
// make sure classes will be deserialized from caches
$this->_em->getMetadataFactory()->setMetadataFor(__NAMESPACE__ . '\\DDC742User', null);
$this->_em->getMetadataFactory()->setMetadataFor(__NAMESPACE__ . '\\DDC742Comment', null);
}
示例7: clear
/**
* Clears all cache records.
*
* @return boolean TRUE if cache is cleared FALSE otherwise
*/
public function clear()
{
if (false === $this->_cache->flush()) {
return $this->_onError('clear');
}
return true;
}
示例8: run
public function run($request)
{
// Flush memcache
if (defined('DEVTOOLKIT_USE_MEMCACHED') && DEVTOOLKIT_USE_MEMCACHED) {
$host = defined('MEMCACHE_HOST') ? MEMCACHE_HOST : 'localhost';
$port = defined('MEMCACHE_PORT') ? MEMCACHE_PORT : 11211;
$memcache = new Memcache();
$connected = $memcache->connect($host, $port);
if ($connected) {
echo "Flush memcache<br/>";
$memcache->flush();
}
}
// Clear file cache
$folder = TEMP_FOLDER;
$di = new RecursiveDirectoryIterator($folder, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($ri as $file) {
echo "Deleting " . $file . '<br/>';
if ($file->isFile()) {
unlink($file);
}
}
echo '<hr>Clear completed!';
}
示例9: clear
/**
* Clear/flush all cached data.
*
* @return bool
*/
public function clear()
{
if ($this->open()) {
return $this->memcache->flush();
}
return false;
}
示例10: defaultAction
public function defaultAction()
{
$memcache = new Memcache();
$memcache->flush();
$usuario = new Usuario();
$daoUsuario = DAOFactory::getUsuarioDAO();
/** @var $user User */
$user = UserService::getCurrentUser();
if (isset($user)) {
$usuarioBD = $daoUsuario->queryByGoogle($user->getUserId());
if (!$usuarioBD) {
// No existe el usuario
$usuario->google = $user->getUserId();
$usuario->correo = $user->getEmail();
$usuario->nombre = $user->getNickname();
$daoUsuario->insert($usuario);
} else {
$usuario = $usuarioBD;
}
$_SESSION['logoutUrl'] = UserService::createLogoutUrl('/index/closeSession');
$_SESSION['usuario'] = $usuario;
include 'vod/index.php';
} else {
$this->login();
}
}
示例11: flush
/**
* @see Cache::flush()
*/
public function flush()
{
if (!$this->is_connected) {
return false;
}
return $this->memcache->flush();
}
示例12: flush
/**
* Flush all existing items in storage.
*
* @return boolean
*
* @since __DEPLOY_VERSION__
*/
public function flush()
{
if (!$this->lockindex()) {
return false;
}
return static::$_db->flush();
}
示例13: GC
/**
* @param int $iTimeToClearInHours = 24
*
* @return bool
*/
public function GC($iTimeToClearInHours = 24)
{
if (0 === $iTimeToClearInHours && $this->oMem) {
return $this->oMem->flush();
}
return false;
}
示例14: flush
public function flush()
{
if (!isset($this->memcache)) {
$this->connect();
}
return $this->memcache->flush();
}
示例15: clean
/**
* Removes items from the cache by conditions & garbage collector.
* @param array conditions
* @return void
*/
public function clean(array $conds)
{
if (!empty($conds[Cache::ALL])) {
$this->memcache->flush();
} elseif (isset($conds[Cache::TAGS]) || isset($conds[Cache::PRIORITY])) {
throw new NotSupportedException('Tags and priority is not supported by MemcachedStorage.');
}
}