当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractAdapter::internalRemoveItems方法代码示例

本文整理汇总了PHP中Zend\Cache\Storage\Adapter\AbstractAdapter::internalRemoveItems方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractAdapter::internalRemoveItems方法的具体用法?PHP AbstractAdapter::internalRemoveItems怎么用?PHP AbstractAdapter::internalRemoveItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Cache\Storage\Adapter\AbstractAdapter的用法示例。


在下文中一共展示了AbstractAdapter::internalRemoveItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: internalRemoveItems

 /**
  * Internal method to remove multiple items.
  *
  * @param  array $normalizedKeys
  * @return array Array of not removed keys
  * @throws Exception\ExceptionInterface
  */
 protected function internalRemoveItems(array &$normalizedKeys)
 {
     $memc = $this->getMemcachedResource();
     // support for removing multiple items at once has been added in ext/memcached-2.0.0
     // and HHVM doesn't support this feature yet
     if (!method_exists($memc, 'deleteMulti')) {
         return parent::internalRemoveItems($normalizedKeys);
     }
     foreach ($normalizedKeys as &$normalizedKey) {
         $normalizedKey = $this->namespacePrefix . $normalizedKey;
     }
     $missingKeys = [];
     foreach ($memc->deleteMulti($normalizedKeys) as $normalizedKey => $rsCode) {
         if ($rsCode !== true && $rsCode != MemcachedResource::RES_SUCCESS) {
             if ($rsCode != MemcachedResource::RES_NOTFOUND) {
                 throw $this->getExceptionByResultCode($rsCode);
             }
             $missingKeys[] = $normalizedKey;
         }
     }
     // remove namespace prefix
     if ($missingKeys && $this->namespacePrefix !== '') {
         $nsPrefixLength = strlen($this->namespacePrefix);
         foreach ($missingKeys as &$missingKey) {
             $missingKey = substr($missingKey, $nsPrefixLength);
         }
     }
     return $missingKeys;
 }
开发者ID:stephenmoore56,项目名称:mooredatabase-laravel,代码行数:36,代码来源:Memcached.php

示例2: internalRemoveItems

 /**
  * Internal method to remove multiple items.
  *
  * @param  array $normalizedKeys
  * @return array Array of not removed keys
  * @throws Exception\ExceptionInterface
  */
 protected function internalRemoveItems(array &$normalizedKeys)
 {
     // support for removing multiple items at once has been added in ext/memcached-2.0.0
     if (static::$extMemcachedMajorVersion < 2) {
         return parent::internalRemoveItems($normalizedKeys);
     }
     $memc = $this->getMemcachedResource();
     foreach ($normalizedKeys as &$normalizedKey) {
         $normalizedKey = $this->namespacePrefix . $normalizedKey;
     }
     $rsCodes = $memc->deleteMulti($normalizedKeys);
     $missingKeys = array();
     foreach ($rsCodes as $key => $rsCode) {
         if ($rsCode !== true && $rsCode != MemcachedResource::RES_SUCCESS) {
             if ($rsCode != MemcachedResource::RES_NOTFOUND) {
                 throw $this->getExceptionByResultCode($rsCode);
             }
             $missingKeys[] = $key;
         }
     }
     // remove namespace prefix
     if ($missingKeys && $this->namespacePrefix !== '') {
         $nsPrefixLength = strlen($this->namespacePrefix);
         foreach ($missingKeys as &$missingKey) {
             $missingKey = substr($missingKey, $nsPrefixLength);
         }
     }
     return $missingKeys;
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:36,代码来源:Memcached.php

示例3: internalRemoveItems

 /**
  * Internal method to remove multiple items.
  *
  * Options:
  *  - namespace <string>
  *    - The namespace to use
  *  - ignore_missing_items <boolean>
  *    - Throw exception on missing item
  *
  * @param  array $keys
  * @param  array $options
  * @return boolean
  * @throws Exception\ExceptionInterface
  */
 protected function internalRemoveItems(array &$normalizedKeys, array &$normalizedOptions)
 {
     // support for removing multiple items at once has been added in ext/memcached-2.0.0
     if (static::$extMemcachedMajorVersion < 2) {
         return parent::internalRemoveItems($normalizedKeys, $normalizedOptions);
     }
     $this->memcached->setOption(MemcachedResource::OPT_PREFIX_KEY, $normalizedOptions['namespace']);
     $rsCodes = $this->memcached->deleteMulti($normalizedKeys);
     $missingKeys = null;
     foreach ($rsCodes as $key => $rsCode) {
         if ($rsCode !== true && $rsCode != 0) {
             if ($rsCode != MemcachedResource::RES_NOTFOUND) {
                 throw $this->getExceptionByResultCode($rsCode);
             }
             $missingKeys[] = $key;
         }
     }
     if ($missingKeys && !$normalizedOptions['ignore_missing_items']) {
         throw new Exception\ItemNotFoundException("Keys '" . implode("','", $missingKeys) . "' not found within namespace '{$normalizedOptions['namespace']}'");
     }
     return true;
 }
开发者ID:brikou,项目名称:zend_cache,代码行数:36,代码来源:Memcached.php


注:本文中的Zend\Cache\Storage\Adapter\AbstractAdapter::internalRemoveItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。