Skip to content

Commit

Permalink
Model增加setCache方法用于设置缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Feb 24, 2025
1 parent cfeb435 commit 5493dd2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,21 @@ public function dec(string $field, float $step = 1, int $lazyTime = 0)
return $this->set($field, new Express('-', $step, $lazyTime));
}

/**
* 查询缓存 数据为空不缓存.
*
* @param mixed $key 缓存key
* @param int|\DateTime $expire 缓存有效期
* @param string|array $tag 缓存标签
*
* @return $this
*/
public function setCache($key = true, $expire = null, $tag = null)
{
$this->db()->cache($key, $expire, $tag);
return $this;
}

/**
* 获取属性 支持获取器
*
Expand Down

0 comments on commit 5493dd2

Please sign in to comment.