mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
Cache类的get方法增加默认值参数
This commit is contained in:
5
library/think/cache/driver/Sqlite.php
vendored
5
library/think/cache/driver/Sqlite.php
vendored
@@ -64,9 +64,10 @@ class Sqlite
|
||||
* 读取缓存
|
||||
* @access public
|
||||
* @param string $name 缓存变量名
|
||||
* @param mixed $default 默认值
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($name)
|
||||
public function get($name, $default = false)
|
||||
{
|
||||
$name = $this->options['prefix'] . sqlite_escape_string($name);
|
||||
$sql = 'SELECT value FROM ' . $this->options['table'] . ' WHERE var=\'' . $name . '\' AND (expire=0 OR expire >' . $_SERVER['REQUEST_TIME'] . ') LIMIT 1';
|
||||
@@ -79,7 +80,7 @@ class Sqlite
|
||||
}
|
||||
return unserialize($content);
|
||||
}
|
||||
return false;
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user