From 2971e93fd5d91fef8c97873787466d75d0647a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E5=B9=B3=E5=87=A1?= Date: Tue, 21 Mar 2017 14:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dinc=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/Memcached.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/think/cache/driver/Memcached.php b/library/think/cache/driver/Memcached.php index fa312e8e..12610646 100644 --- a/library/think/cache/driver/Memcached.php +++ b/library/think/cache/driver/Memcached.php @@ -125,7 +125,10 @@ class Memcached extends Driver public function inc($name, $step = 1) { $key = $this->getCacheKey($name); - return $this->handler->increment($key, $step); + if( $this->has($name) ){ + return $this->handler->increment($key, $step); + } + return $this->handler->set($key, $step); } /**