This commit is contained in:
thinkphp
2018-01-01 20:19:31 +08:00
3 changed files with 66 additions and 4 deletions

View File

@@ -109,7 +109,7 @@ class File extends Driver
$content = file_get_contents($filename);
if (false !== $content) {
$expire = (int) substr($content, 8, 12);
if (0 != $expire && $_SERVER['REQUEST_TIME'] > filemtime($filename) + $expire) {
if (0 != $expire && time() > filemtime($filename) + $expire) {
return $default;
}
$content = substr($content, 32);

View File

@@ -46,9 +46,12 @@ class Redis extends Driver
if (!empty($options)) {
$this->options = array_merge($this->options, $options);
}
$func = $this->options['persistent'] ? 'pconnect' : 'connect';
$this->handler = new \Redis;
$this->handler->$func($this->options['host'], $this->options['port'], $this->options['timeout']);
if ($this->options['persistent']) {
$this->handler->pconnect($this->options['host'], $this->options['port'], $this->options['timeout'], 'persistent_id_' . $this->options['select']);
} else {
$this->handler->connect($this->options['host'], $this->options['port'], $this->options['timeout']);
}
if ('' != $this->options['password']) {
$this->handler->auth($this->options['password']);