當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::sMembers方法代碼示例

本文整理匯總了PHP中Predis\Client::sMembers方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::sMembers方法的具體用法?PHP Client::sMembers怎麽用?PHP Client::sMembers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Predis\Client的用法示例。


在下文中一共展示了Client::sMembers方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: refreshIndex

 /**
  * Refresh the local cache index from the cache.
  * The index is stored in Redis as a set with the key <prefix>::index.
  * Items are added and removed from the index via the write and delete but
  * are also expired automatically by Redis. This function reads the index
  * set and checks the TTL of each key, removing those that no longer exist
  * from the index.
  * @return self
  */
 public function refreshIndex()
 {
     if ($this->indexing) {
         $expired = array();
         foreach ($this->store->sMembers("{$this->prefix}::index") as $k) {
             switch ($this->index[$k] = $this->store->ttl($k)) {
                 case -2:
                     $expired[] = $k;
                     unset($this->index[$k]);
                     break;
                 case -1:
                     // We're not running Redis 2.8 yet so we always get -1
                     // we'll assume all keys have an expiry and remove any without in order to keep the index clean
                     //$this->index[$k] = 2147483648;
                     $expired[] = $k;
                     unset($this->index[$k]);
                     break;
                 default:
                     $this->index[$k] = time() + $this->index[$k];
             }
         }
         foreach ($expired as $k) {
             $this->removeFromIndex($k);
         }
     }
     return $this;
 }
開發者ID:simon-downes,項目名稱:spf,代碼行數:36,代碼來源:Redis.php

示例2: isAllowed

 /**
  * {@inheritdoc}
  * Example:
  * <code>
  * //Does Andres have access to the customers resource to create?
  * $acl->isAllowed('Andres', 'Products', 'create');
  * //Do guests have access to any resource to edit?
  * $acl->isAllowed('guests', '*', 'edit');
  * </code>
  *
  * @param string $role
  * @param string $resource
  * @param string $access
  *
  * @return bool
  */
 public function isAllowed($role, $resource, $access)
 {
     if ($this->redis->sIsMember("accessList:{$role}:{$resource}:" . Acl::ALLOW, $access)) {
         return Acl::ALLOW;
     }
     if ($this->redis->exists("rolesInherits:{$role}")) {
         $rolesInherits = $this->redis->sMembers("rolesInherits:{$role}");
         foreach ($rolesInherits as $role) {
             if ($this->redis->sIsMember("accessList:{$role}:{$resource}:" . Acl::ALLOW, $access)) {
                 return Acl::ALLOW;
             }
         }
     }
     /**
      * Return the default access action
      */
     return $this->getDefaultAction();
 }
開發者ID:nineeshk,項目名稱:incubator,代碼行數:34,代碼來源:Redis.php

示例3: getListItems

 /**
  * @param $key
  * @return mixed
  */
 public function getListItems($key)
 {
     return $this->client->sMembers($key);
 }
開發者ID:splitio,項目名稱:php-client,代碼行數:8,代碼來源:PRedis.php


注:本文中的Predis\Client::sMembers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。