當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。