当前位置: 首页>>代码示例>>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;未经允许,请勿转载。