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


PHP Cache::setValues方法代码示例

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


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

示例1: setValues

 /**
  * Stores multiple key-value pairs in cache.
  * @param array $data array where key corresponds to cache key while value is the value stored
  * @param integer $duration the number of seconds in which the cached values will expire. 0 means never expire.
  * @return array array of failed keys. Always empty in case of using memcached.
  */
 protected function setValues($data, $duration)
 {
     if ($this->useMemcached) {
         $this->_cache->setMulti($data, $duration > 0 ? $duration + time() : 0);
         return [];
     } else {
         return parent::setValues($data, $duration);
     }
 }
开发者ID:noorafree,项目名称:makmakan,代码行数:15,代码来源:MemCache.php

示例2: setValues

 /**
  * Stores multiple key-value pairs in cache.
  * @param array $data array where key corresponds to cache key while value is the value stored
  * @param integer $duration the number of seconds in which the cached values will expire. 0 means never expire.
  * @return array array of failed keys. Always empty in case of using memcached.
  */
 protected function setValues($data, $duration)
 {
     return parent::setValues($data, $duration);
 }
开发者ID:robinclark007,项目名称:sae-yii2-memcache,代码行数:10,代码来源:SaeMemCache.php

示例3: setValues

 /**
  * Stores multiple key-value pairs in cache.
  * @param array $data array where key corresponds to cache key while value is the value stored
  * @param int $duration the number of seconds in which the cached values will expire. 0 means never expire.
  * @return array array of failed keys. Always empty in case of using memcached.
  */
 protected function setValues($data, $duration)
 {
     if ($this->useMemcached) {
         // Use UNIX timestamp since it doesn't have any limitation
         // @see http://php.net/manual/en/memcache.set.php
         // @see http://php.net/manual/en/memcached.expiration.php
         $expire = $duration > 0 ? $duration + time() : 0;
         $this->_cache->setMulti($data, $expire);
         return [];
     } else {
         return parent::setValues($data, $duration);
     }
 }
开发者ID:arogachev,项目名称:yii2,代码行数:19,代码来源:MemCache.php

示例4: setValues

 /**
  * Stores multiple key-value pairs in cache.
  * @param array $data array where key corresponds to cache key while value is the value stored
  * @param integer $expire the number of seconds in which the cached values will expire. 0 means never expire.
  * @return array array of failed keys. Always empty in case of using memcached.
  */
 protected function setValues($data, $expire)
 {
     if ($this->useMemcached) {
         if ($expire > 0) {
             $expire += time();
         } else {
             $expire = 0;
         }
         $this->_cache->setMulti($data, $expire);
         return [];
     } else {
         return parent::setValues($data, $expire);
     }
 }
开发者ID:davidpersson,项目名称:FrameworkBenchmarks,代码行数:20,代码来源:MemCache.php


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