分享

延迟更新

 丶平上 2016-12-15
/**
* 字段值延迟增长
* @access public
* @param string $field 字段名
* @param integer $step 增长值
* @param integer $lazyTime 延时时间(s)
* @return boolean
*/
1    public function setLazyInc($field,$step=1,$lazyTime=0) {
2               $condition = $this->options[‘where’];
3              if(empty($condition)) {        // 没有条件不做任何更新
4                           return false;
5               }
6              if($lazyTime>0) {// 延迟写入
7                           dump($this->name);//debug
8                           dump($field,true);//debug
9                           dump($condition,true);//debug
10                         echo $guid = md5($this->name.’_’.$field.’_’.serialize($condition));
11                         $step = $this->lazyWrite($guid,$step,$lazyTime);
12                          if(false === $step ) return true; // 等待下次写入
13            }
14           return $this->setField($field,array(‘exp’,$field.’+’.$step));
15   }

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多