本文整理汇总了PHP中Predis\Client::getProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::getProfile方法的具体用法?PHP Client::getProfile怎么用?PHP Client::getProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::getProfile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isPubSubSupported
/**
* Checks if the driver supports publish/subscribe pattern.
*
* @return bool
*/
public function isPubSubSupported()
{
if ((double) $this->client->getProfile()->getVersion() >= 2.8) {
return true;
}
return false;
}
示例2: checkCapabilities
/**
* Checks if the passed client instance satisfies the required conditions
* needed to initialize a Publish / Subscribe context.
*
* @param Client Client instance used by the context.
*/
private function checkCapabilities(Client $client)
{
if (Helpers::isCluster($client->getConnection())) {
throw new NotSupportedException('Cannot initialize a PUB/SUB context over a cluster of connections');
}
$commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
if ($client->getProfile()->supportsCommands($commands) === false) {
throw new NotSupportedException('The current profile does not support PUB/SUB related commands');
}
}
示例3: checkCapabilities
/**
* Checks if the passed client instance satisfies the required conditions
* needed to initialize a transaction context.
*
* @param Client Client instance used by the context.
*/
private function checkCapabilities(Client $client)
{
if (Helpers::isCluster($client->getConnection())) {
throw new NotSupportedException('Cannot initialize a MULTI/EXEC context over a cluster of connections');
}
$profile = $client->getProfile();
if ($profile->supportsCommands(array('multi', 'exec', 'discard')) === false) {
throw new NotSupportedException('The current profile does not support MULTI, EXEC and DISCARD');
}
$this->canWatch = $profile->supportsCommands(array('watch', 'unwatch'));
}
示例4: testConstructorWithNullAndArrayArgument
/**
* @group disconnected
*/
public function testConstructorWithNullAndArrayArgument()
{
$factory = $this->getMock('Predis\\Connection\\ConnectionFactoryInterface');
$arg2 = array('profile' => '2.0', 'prefix' => 'prefix:', 'connections' => $factory);
$client = new Client(null, $arg2);
$profile = $client->getProfile();
$this->assertSame($profile->getVersion(), ServerProfile::get('2.0')->getVersion());
$this->assertInstanceOf('Predis\\Command\\Processor\\KeyPrefixProcessor', $profile->getProcessor());
$this->assertSame('prefix:', $profile->getProcessor()->getPrefix());
$this->assertSame($factory, $client->getConnectionFactory());
}
示例5: setRedis
/**
* Sets the redis instance to use.
*
* @param \Predis\Client $redis
*/
public function setRedis(\Predis\Client $redis)
{
$this->_redis = $redis;
$this->_supportsSetExpire = $redis->getProfile()->supportsCommand('setex');
}
示例6: checkCapabilities
/**
* Checks if the passed client instance satisfies the required conditions
* needed to initialize a monitor context.
*
* @param Client Client instance used by the context.
*/
private function checkCapabilities(Client $client)
{
if (Helpers::isCluster($client->getConnection())) {
throw new ClientException('Cannot initialize a monitor context over a cluster of connections');
}
if ($client->getProfile()->supportsCommand('monitor') === false) {
throw new ClientException('The current profile does not support the MONITOR command');
}
}