Query类的update和delete方法支持调用cache方法 会自动清除指定key的缓存 配合查询方法的cache方法一起使用 Model类的get方法第三个参数传入true的时候会自动更新缓存

This commit is contained in:
thinkphp
2016-08-17 11:17:03 +08:00
parent f3ff63268a
commit dfb92fa9dd
2 changed files with 7 additions and 3 deletions

View File

@@ -1769,6 +1769,10 @@ class Query
{
$options = $this->parseExpress();
$pk = $this->getPk($options);
if (isset($options['cache']) && is_string($options['cache'])) {
$key = $options['cache'];
}
if (empty($options['where'])) {
// 如果存在主键数据 则自动作为更新条件
if (is_string($pk) && isset($data[$pk])) {
@@ -2095,6 +2099,9 @@ class Query
{
// 分析查询表达式
$options = $this->parseExpress();
if (isset($options['cache']) && is_string($options['cache'])) {
$key = $options['cache'];
}
if (!is_null($data) && true !== $data) {
if (!is_array($data)) {