From 9134d8a3e5f429ce326f368f2a846e5129bf0318 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 13 Jan 2018 22:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bfile=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E7=9A=84=E7=BC=93=E5=AD=98inc=E5=92=8Cdec=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=B8=8D=E6=94=B9=E5=8F=98=E7=BC=93=E5=AD=98=E6=9C=89=E6=95=88?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/File.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/library/think/cache/driver/File.php b/library/think/cache/driver/File.php index cafa0c01..307c2fa1 100644 --- a/library/think/cache/driver/File.php +++ b/library/think/cache/driver/File.php @@ -170,11 +170,14 @@ class File extends Driver public function inc($name, $step = 1) { if ($this->has($name)) { - $value = $this->get($name) + $step; + $value = $this->get($name) + $step; + $expire = $this->expire; } else { - $value = $step; + $value = $step; + $expire = 0; } - return $this->set($name, $value, 0) ? $value : false; + + return $this->set($name, $value, $expire) ? $value : false; } /** @@ -187,11 +190,14 @@ class File extends Driver public function dec($name, $step = 1) { if ($this->has($name)) { - $value = $this->get($name) - $step; + $value = $this->get($name) - $step; + $expire = $this->expire; } else { - $value = -$step; + $value = -$step; + $expire = 0; } - return $this->set($name, $value, 0) ? $value : false; + + return $this->set($name, $value, $expire) ? $value : false; } /**