本文整理汇总了PHP中Predis\Client::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::select方法的具体用法?PHP Client::select怎么用?PHP Client::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list
function __construct($url)
{
try {
list($user, $passwd, $host, $port, $db) = self::parseRedisUrl($url);
$this->_redis = new Client(array('host' => $host, 'port' => $port));
} catch (\Exception $e) {
throw new RedisBundleException($e);
}
try {
$this->_redis->connect();
$this->_redis->select($db);
} catch (\Predis\Connection\ConnectionException $e) {
throw new RedisBundleException($e);
}
}
示例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;
}
示例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;
}
}
示例4: 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;
}
示例5: __construct
public function __construct()
{
$this->redis = new Client(array('host' => self::$host, 'port' => self::$port, 'database' => self::$port));
$this->redis->select(self::$db);
}
示例6: createClient
public function createClient()
{
$client = new Predis\Client();
$client->select(10);
return $client;
}
示例7: select
/**
* @inheritdoc
*/
public function select($database)
{
parent::select($database);
$this->server->setDatabaseIndex($database);
}
示例8: select
public function select($database)
{
return $this->_client->select($database);
}