当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::flushdb方法代码示例

本文整理汇总了PHP中Predis\Client::flushdb方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::flushdb方法的具体用法?PHP Client::flushdb怎么用?PHP Client::flushdb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Predis\Client的用法示例。


在下文中一共展示了Client::flushdb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cleanup

 /**
  * Delete all the keys in the Redis database
  *
  * @throws ModuleException
  */
 public function cleanup()
 {
     try {
         $this->driver->flushdb();
     } catch (\Exception $e) {
         throw new ModuleException(__CLASS__, $e->getMessage());
     }
 }
开发者ID:solutionDrive,项目名称:Codeception,代码行数:13,代码来源:Redis.php

示例2: getClient

 /**
  * Returns a new client instance.
  *
  * @return Client
  */
 protected function getClient()
 {
     $parameters = array('host' => REDIS_SERVER_HOST, 'port' => REDIS_SERVER_PORT, 'iterable_multibulk' => true, 'read_write_timeout' => 2);
     $client = new Client($parameters, REDIS_SERVER_VERSION);
     $client->connect();
     $client->select(REDIS_SERVER_DBNUM);
     $client->flushdb();
     return $client;
 }
开发者ID:keneanung,项目名称:gw2spidy,代码行数:14,代码来源:MultiBulkResponseTupleTest.php

示例3: setupFeature

 /** @BeforeFeature */
 public static function setupFeature(FeatureEvent $event)
 {
     try {
         $redis = new Client('tcp://127.0.0.1:6379');
         $redis->select(15);
         $redis->flushdb();
     } catch (\Exception $e) {
         echo "Redis Server is needed to test features!" . PHP_EOL;
         throw $e;
     }
 }
开发者ID:redtrine,项目名称:redtrine,代码行数:12,代码来源:FeatureContext.php

示例4: setUp

 public function setUp()
 {
     if (!class_exists('Predis\\Client')) {
         $this->markTestSkipped('The ' . __CLASS__ . ' requires Predis to be available');
     }
     try {
         $client = new Client();
         $client->connect();
         $client->flushdb();
     } catch (ConnectionException $e) {
         $this->markTestSkipped('The ' . __CLASS__ . ' requires the use of a Redis Server');
     }
     $this->storage = new RedisStorage($client);
 }
开发者ID:battlerattle,项目名称:shuffle-bag,代码行数:14,代码来源:RedisStorageTest.php

示例5: clear

 /**
  * {@inheritdoc}
  */
 public function clear($key = null)
 {
     if (is_null($key)) {
         $this->redis->flushdb();
         return true;
     }
     $keyString = $this->makeKeyString($key, true);
     $keyReal = $this->makeKeyString($key);
     $this->redis->incr($keyString);
     // increment index for children items
     $this->redis->del($keyReal);
     // remove direct item.
     $this->keyCache = array();
     return true;
 }
开发者ID:sergeym,项目名称:Stash,代码行数:18,代码来源:Predis.php

示例6: setUp

 public function setUp()
 {
     if (!class_exists('\\Predis\\Client', true)) {
         $this->markTestSkipped('PRedis is not installed');
     }
     $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
     // setup the default timeout (avoid max execution time)
     socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 1, 'usec' => 0));
     $result = @socket_connect($socket, '127.0.0.1', 6379);
     if (!$result) {
         $this->markTestSkipped('Redis is not running');
     }
     socket_close($socket);
     $client = new Client(array('host' => '127.0.0.1', 'port' => 6379, 'database' => 42));
     $client->flushdb();
 }
开发者ID:sonata-project,项目名称:cache,代码行数:16,代码来源:PRedisCacheTest.php

示例7: getClient

 /**
  * Returns a new client instance.
  *
  * @param Boolean $connect Flush selected database before returning the client.
  * @return Client
  */
 protected function getClient($flushdb = true)
 {
     $profile = $this->getProfile();
     if (!$profile->supportsCommand($id = $this->getExpectedId())) {
         $this->markTestSkipped("The profile {$profile->getVersion()} does not support command {$id}");
     }
     $parameters = array('host' => REDIS_SERVER_HOST, 'port' => REDIS_SERVER_PORT);
     $options = array('profile' => $profile);
     $client = new Client($parameters, $options);
     $client->connect();
     $client->select(REDIS_SERVER_DBNUM);
     if ($flushdb) {
         $client->flushdb();
     }
     return $client;
 }
开发者ID:surjit,项目名称:node-redis-php-chat-app,代码行数:22,代码来源:CommandTestCase.php

示例8: doFlush

 /**
  * {@inheritdoc}
  */
 protected function doFlush()
 {
     return (bool) $this->redis->flushdb();
 }
开发者ID:slaparra,项目名称:voting-details,代码行数:7,代码来源:RedisCache.php

示例9: getClient

 /**
  * Returns a new client instance.
  *
  * @return Client
  */
 protected function getClient()
 {
     $parameters = $this->getParameters(array('read_write_timeout' => 2));
     $protocol = new TextProtocolProcessor();
     $protocol->useIterableMultibulk(true);
     $connection = new CompositeStreamConnection($parameters, $protocol);
     $client = new Client($connection);
     $client->connect();
     $client->flushdb();
     return $client;
 }
开发者ID:pikniktech,项目名称:dailybriefweb2,代码行数:16,代码来源:MultiBulkTupleTest.php

示例10: clearAll

 public function clearAll()
 {
     $this->redis->flushdb();
 }
开发者ID:PhanQuocTrung,项目名称:WeatherStation,代码行数:4,代码来源:Redis.php

示例11: createClient

 /**
  * Returns a new client instance.
  *
  * @param  array  $parameters Additional connection parameters.
  * @param  array  $options    Additional client options.
  * @param  bool   $flushdb    Flush selected database before returning the client.
  * @return Client
  */
 protected function createClient(array $parameters = null, array $options = null, $flushdb = true)
 {
     $parameters = array_merge($this->getDefaultParametersArray(), $parameters ?: array());
     $options = array_merge(array('profile' => $this->getProfile()), $options ?: array());
     $client = new Client($parameters, $options);
     $client->connect();
     if ($flushdb) {
         $client->flushdb();
     }
     return $client;
 }
开发者ID:ningcaichen,项目名称:laravel-4.1-quick-start-cn,代码行数:19,代码来源:PredisTestCase.php

示例12: clear

 /**
  * @inheritdoc
  */
 public function clear()
 {
     return $this->predis->flushdb();
 }
开发者ID:savritsky,项目名称:cache,代码行数:7,代码来源:PredisDriver.php

示例13: flushAll

 public function flushAll()
 {
     $this->redis->flushdb();
 }
开发者ID:maximebf,项目名称:cachecache,代码行数:4,代码来源:Redis.php

示例14: Client

<?php

use Bravo3\Orm\Drivers\Filesystem\FilesystemDriver;
use Bravo3\Orm\Drivers\Filesystem\Io\NativeIoDriver;
use Bravo3\Orm\Mappers\Annotation\AnnotationMapper;
use Bravo3\Orm\Mappers\Portation\MapWriterInterface;
use Bravo3\Orm\Mappers\Yaml\YamlMapWriter;
use Bravo3\Orm\Services\EntityLocator;
use Bravo3\Orm\Services\EntityManager;
use Bravo3\Properties\Conf;
use Predis\Client;
require __DIR__ . '/../vendor/autoload.php';
Conf::init(__DIR__ . '/config/', 'parameters.yml');
$redis = new Client(['host' => Conf::get('parameters.redis_host'), 'port' => Conf::get('parameters.redis_port'), 'database' => Conf::get('parameters.redis_database')]);
$redis->flushdb();
// Solely for portation (reading metadata) - will never do anything
$em = EntityManager::build(new FilesystemDriver(new NativeIoDriver('/dev/null')), new AnnotationMapper());
$locator = new EntityLocator($em);
$entities = $locator->locateEntities(__DIR__ . '/Bravo3/Orm/Tests/Entities', 'Bravo3\\Orm\\Tests\\Entities');
/** @var MapWriterInterface[] $porters */
$porters = [new YamlMapWriter(__DIR__ . '/Bravo3/Orm/Tests/Resources/mappings.yml')];
foreach ($porters as $porter) {
    $porter->setInputManager($em);
    foreach ($entities as $class_name) {
        $porter->compileMetadataForEntity($class_name);
    }
    $porter->flush();
}
开发者ID:bravo3,项目名称:orm,代码行数:28,代码来源:bootstrap.php

示例15: setUp

 protected function setUp()
 {
     $this->client = $this->createClient();
     $this->redis_client = new \Predis\Client();
     $this->redis_client->flushdb();
 }
开发者ID:aol,项目名称:cachelink-client-php,代码行数:6,代码来源:CacheLinkClientTest.php


注:本文中的Predis\Client::flushdb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。