summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache
diff options
context:
space:
mode:
authortianhe1986 <w1s2j3229@163.com>2018-01-04 10:10:50 +0100
committertianhe1986 <w1s2j3229@163.com>2018-01-04 10:10:50 +0100
commitf87fb6dd6c5406029bb1a26d6ba6933d4a69d26e (patch)
tree8c2cf9f2e4c780a39470534d2876dc4c93e37ae6 /system/libraries/Cache
parent89da3a5bf7a87bcbc922ed4b57ba26e875807dba (diff)
Calling another increment/decrement if add() return FALSE.
Signed-off-by: tianhe1986 <w1s2j3229@163.com>
Diffstat (limited to 'system/libraries/Cache')
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index cbf874b97..8b6af84db 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -212,8 +212,7 @@ class CI_Cache_memcached extends CI_Driver {
{
if (($result = $this->_memcached->increment($id, $offset)) === FALSE)
{
- $this->_memcached->add($id, 0);
- $result = $this->_memcached->increment($id, $offset);
+ return $this->_memcached->add($id, $offset) ? $offset : $this->_memcached->increment($id, $offset);
}
return $result;
@@ -232,8 +231,7 @@ class CI_Cache_memcached extends CI_Driver {
{
if (($result = $this->_memcached->decrement($id, $offset)) === FALSE)
{
- $this->_memcached->add($id, 0);
- $result = $this->_memcached->decrement($id, $offset);
+ return $this->_memcached->add($id, 0) ? 0 : $this->_memcached->decrement($id, $offset);
}
return $result;