本文整理汇总了PHP中Predis\ClientInterface::sismember方法的典型用法代码示例。如果您正苦于以下问题:PHP ClientInterface::sismember方法的具体用法?PHP ClientInterface::sismember怎么用?PHP ClientInterface::sismember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\ClientInterface
的用法示例。
在下文中一共展示了ClientInterface::sismember方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkNonceAndTimestampUnicity
/**
* Helper function to perform necessary checks on timestamp and nonce.
*
* @param $nonce
* @param $timestamp
* @param ConsumerInterface $consumer
* @return bool
*/
public function checkNonceAndTimestampUnicity($nonce, $timestamp, ConsumerInterface $consumer)
{
// Check timestamp: The timestamp value MUST be a positive integer
// and MUST be equal or greater than the timestamp used in previous requests.
// @see http://oauth.net/core/1.0/#nonce
if (!ctype_digit($timestamp)) {
throw new \InvalidArgumentException('Timestamp should be a positive integer, got ' . $this->checkPlain($timestamp));
}
$timestampsKey = $this->timestampsKey($consumer);
$sortedSet = $this->client->zrevrange($timestampsKey, 0, -1);
if (is_array($sortedSet) && !empty($sortedSet)) {
$maxTimestamp = $sortedSet[0];
if ($timestamp < $maxTimestamp) {
throw new \InvalidArgumentException('Timestamp must be bigger than your last timestamp we have recorded');
}
}
$noncesRedisKey = $this->noncesRedisKey($consumer, $timestamp);
$exists = $this->client->sismember($noncesRedisKey, $nonce);
return !$exists;
}
示例2: sismember
/**
* {@inheritDoc}
*/
public function sismember($key, $member)
{
return $this->predis->sismember($key, $member);
}