本文整理汇总了PHP中Redis::flushAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Redis::flushAll方法的具体用法?PHP Redis::flushAll怎么用?PHP Redis::flushAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redis
的用法示例。
在下文中一共展示了Redis::flushAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* @requires extension redis
*/
protected function setUp()
{
if (!extension_loaded('redis')) {
$this->markTestSkipped('redis extension not installed');
}
$this->redis = new \Redis();
if (false === @$this->redis->connect('127.0.0.1')) {
unset($this->redis);
$this->markTestSkipped('Could not connect to Redis instance');
}
$this->redis->flushAll();
parent::setUp();
}
示例2: clearAll
/**
* 清空数据
*/
public function clearAll() {
try {
return $this->_redis->flushAll();
} catch (Exception $e) {
$this->_error = $e->getMessage();
return false;
}
}
示例3: delete
/**
* 删除指定key的缓存,若$key===true则表示删除全部
*
* @param string $key
*/
public function delete($key)
{
$this->_connect();
if ($key === true) {
return $this->_redis->flushAll();
} else {
$keys = func_get_args();
return $this->_redis->delete($keys);
}
}
示例4: flush
/**
* Flush all data from the cache server?
*/
public function flush()
{
if ($this->connected === true && $this->ping() === true) {
if ($this->isRedis === true) {
$this->server->flushAll();
} else {
$this->server->flush();
}
}
}
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
if (!extension_loaded('redis')) {
static::$cache = null;
return;
}
$redis = new \Redis();
$redis->connect('127.0.0.1');
$redis->select(1);
$redis->flushAll();
static::$cache = new \Cachalot\RedisCache($redis, 'cachalot-test:');
}
示例6: connectRedis
public function connectRedis($host, $port, $db)
{
// Cache in Redis
$cacheRedis = new Redis();
$cacheRedis->connect($host, $port);
$cacheRedis->select($db);
$cacheResult = $cacheRedis->flushAll();
if ($cacheResult == 1) {
Mage::getSingleton('core/session')->addSuccess(Mage::helper('gaugeinteractive_redis')->__('Redis has been flushed.'));
} else {
Mage::getSingleton('core/session')->addError(Mage::helper('gaugeinteractive_redis')->__('An error occurred when flushing Redis.'));
}
}
示例7: Redis
function my_onStart($serv)
{
$redis = new Redis();
$redis->pconnect('127.0.0.1', 6379);
$redis->flushAll();
$work_arr = array();
for ($i = 0; $i < $serv->setting['task_worker_num']; $i++) {
$redis->lpush('free', $i);
$work_arr[] = $i;
}
echo "MasterPid={$serv->master_pid}|Manager_pid={$serv->manager_pid}\n";
echo "Server: start.Swoole version is [" . SWOOLE_VERSION . "]\n";
}
示例8: delete
/**
* 删除指定key的缓存
*
* 若 `$key===true` 则表示删除全部
*
* // 支持下面的方式
* $this->delete('abc');
* $this->delete('abc', 'abc2');
* $this->delete(['abc', 'abc2']);
*
* // 删除全部
* $this->delete(true);
* // 也可使用
* $this->delete_all();
*
* @param string|array|true $key
*/
public function delete($key)
{
$this->_connect();
if (true === $key) {
return $this->_redis->flushAll();
} else {
if (is_array($key)) {
$keys = $key;
} else {
$keys = func_get_args();
}
return $this->_redis->delete($keys);
}
}
示例9: flush
/**
* Flush all data from the cache server?
*/
public function flush()
{
if ($this->ping()) {
switch (NN_CACHE_TYPE) {
case self::TYPE_REDIS:
$this->server->flushAll();
break;
case self::TYPE_MEMCACHED:
$this->server->flush();
break;
case self::TYPE_APC:
apc_clear_cache("user");
apc_clear_cache();
break;
}
}
}
示例10: deleteAll
/**
* Remove all items from the cache (flush it).
*
* @return void
*/
function deleteAll()
{
$this->connection->flushAll();
}
示例11: clear
/**
* Deletes all cache entries
*
* @return bool
*/
public function clear()
{
return $this->cache->flushAll();
}
示例12: testflushAll
public function testflushAll()
{
$this->redis->set('x', 'y');
$this->assertTrue($this->redis->flushAll());
$this->assertTrue($this->redis->getKeys('*') === array());
}
示例13: clear
public function clear()
{
$this->redis->flushAll();
}
示例14: flush
public function flush()
{
$this->redis->flushAll();
}
示例15: array
<?php
// change the following paths if necessary
require_once 'inc/tags/lib/Loader.class.php';
WF_Loader::registerAutoload();
require_once "inc/tags/TagArticles.inc.php";
require_once "inc/tags/Tag.inc.php";
require_once "inc/tags/ArticleTags.inc.php";
require_once "inc/tags/ArticleMini.inc.php";
require_once "inc/tags/TagsKey.inc.php";
require_once "inc/tags/TagSite.inc.php";
require __DIR__ . '/fixtures/util.func.php';
$conf = (require __DIR__ . '/config/test.conf.php');
define("ROOT_DIR", __DIR__);
WF_Registry::set('logger', new WF_Logger());
$instance = WF_Db::instance($conf['db']);
WF_Registry::set('db', $instance);
unset($instance);
WF_DbTestCase::setBasePath(ROOT_DIR . "/fixtures");
WF_Event::bind('addArticleTag', array(TagArticles::model(), 'onAddArticleTag'));
WF_Event::bind('removeArticleTag', array(TagArticles::model(), 'onRemoveArticleTag'));
$redis = new Redis();
$redis_config = $conf['redis'];
$redis->connect($redis_config['host'], $redis_config['port']);
$redis->flushAll();
WF_Registry::set('cache', $redis);
WF_Registry::set('redis', $redis);
WF_Config::set('tagitem_use_cache', true);
TagSite::refresh(__DIR__ . '/data/sites.dat');
$id = TagSite::getSiteId('news');