/** * 字段值延迟增长 * @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 } |
|