本文整理匯總了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');
}
}