替换 time() 为 $_SERVER['REQUEST_TIME']

This commit is contained in:
thinkphp
2016-07-03 15:03:10 +08:00
parent a322a28f27
commit ea9682c724
8 changed files with 13 additions and 13 deletions

View File

@@ -44,7 +44,7 @@ class Sae
public function write($cacheFile, $content)
{
// 添加写入时间
$content = time() . $content;
$content = $_SERVER['REQUEST_TIME'] . $content;
if (!$this->mc->set($cacheFile, $content, MEMCACHE_COMPRESSED, 0)) {
throw new Exception('sae mc write error:' . $cacheFile);
} else {
@@ -76,7 +76,7 @@ class Sae
public function check($cacheFile, $cacheTime)
{
$mtime = $this->get($cacheFile, 'mtime');
if (0 != $cacheTime && time() > $mtime + $cacheTime) {
if (0 != $cacheTime && $_SERVER['REQUEST_TIME'] > $mtime + $cacheTime) {
// 缓存是否在有效期
return false;
}