更新内核
This commit is contained in:
21
core/library/think/cache/Driver.php
vendored
21
core/library/think/cache/Driver.php
vendored
@@ -109,6 +109,27 @@ abstract class Driver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果不存在则写入缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $value 存储数据
|
||||
* @param int $expire 有效时间 0为永久
|
||||
* @return mixed
|
||||
*/
|
||||
public function remember($name, $value, $expire = null)
|
||||
{
|
||||
if (!$this->has($name)) {
|
||||
if ($value instanceof \Closure) {
|
||||
$value = call_user_func($value);
|
||||
}
|
||||
$this->set($name, $value, $expire);
|
||||
} else {
|
||||
$value = $this->get($name);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存标签
|
||||
* @access public
|
||||
|
||||
Reference in New Issue
Block a user