mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进Model的延迟写入方法
This commit is contained in:
@@ -565,9 +565,7 @@ class Query
|
|||||||
// 延迟写入
|
// 延迟写入
|
||||||
$guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
|
$guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
|
||||||
$step = $this->lazyWrite('inc', $guid, $step, $lazyTime);
|
$step = $this->lazyWrite('inc', $guid, $step, $lazyTime);
|
||||||
if (false === $step) {
|
return false === $step ? true : $this->setField($field, $step);
|
||||||
return true; // 等待下次写入
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $this->setField($field, ['exp', $field . '+' . $step]);
|
return $this->setField($field, ['exp', $field . '+' . $step]);
|
||||||
}
|
}
|
||||||
@@ -592,10 +590,7 @@ class Query
|
|||||||
// 延迟写入
|
// 延迟写入
|
||||||
$guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
|
$guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition));
|
||||||
$step = $this->lazyWrite('dec', $guid, $step, $lazyTime);
|
$step = $this->lazyWrite('dec', $guid, $step, $lazyTime);
|
||||||
if (false === $step) {
|
return false === $step ? true : $this->setField($field, $step);
|
||||||
return true; // 等待下次写入
|
|
||||||
}
|
|
||||||
$step = -$step;
|
|
||||||
}
|
}
|
||||||
return $this->setField($field, ['exp', $field . '-' . $step]);
|
return $this->setField($field, ['exp', $field . '-' . $step]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user