本文整理汇总了PHP中Predis\Client::sAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::sAdd方法的具体用法?PHP Client::sAdd怎么用?PHP Client::sAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::sAdd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToIndex
protected function addToIndex($key, $expires = null)
{
if ($this->indexing) {
$this->store->sAdd("{$this->prefix}::index", $key);
}
return parent::addToIndex($key, $expires);
}
示例2: setAccess
/**
* @param $roleName
* @param $resourceName
* @param $accessName
* @param $action
* @return bool
* @throws Exception
*/
protected function setAccess($roleName, $resourceName, $accessName, $action)
{
/**
* Check if the access is valid in the resource
*/
if ($this->isResourceAccess($resourceName, $accessName)) {
if (!$this->setNXAccess) {
throw new Exception("Access '" . $accessName . "' does not exist in resource '" . $resourceName . "' in ACL");
}
$this->addResourceAccess($resourceName, $accessName);
}
$this->redis->sAdd("accessList:{$roleName}:{$resourceName}:{$action}", $accessName);
$accessList = "accessList:{$roleName}:{$resourceName}";
// remove first if exists
foreach (array(1, 2) as $act) {
$this->redis->sRem("{$accessList}:{$act}", $accessName);
$this->redis->sRem("{$accessList}:{$act}", "*");
}
$this->redis->sAdd("{$accessList}:{$action}", $accessName);
$this->redis->sAdd("{$accessList}:{$this->getDefaultAction()}", "*");
return true;
}
示例3: addItemList
/**
* Adds a values to the set value stored at key.
* If this value is already in the set, FALSE is returned.
*
* @param $key
* @param $value
* @return boolean
*/
public function addItemList($key, $value)
{
return $this->client->sAdd($key, $value);
}