summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers/Cache_memcached.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Cache/drivers/Cache_memcached.php')
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index b642a2c03..9dfee475f 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
+ * Copyright (c) 2014 - 2018, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
- * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
+ * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 2.0
@@ -198,7 +198,12 @@ class CI_Cache_memcached extends CI_Driver {
*/
public function increment($id, $offset = 1)
{
- return $this->_memcached->increment($id, $offset);
+ if (($result = $this->_memcached->increment($id, $offset)) === FALSE)
+ {
+ return $this->_memcached->add($id, $offset) ? $offset : FALSE;
+ }
+
+ return $result;
}
// ------------------------------------------------------------------------
@@ -212,7 +217,12 @@ class CI_Cache_memcached extends CI_Driver {
*/
public function decrement($id, $offset = 1)
{
- return $this->_memcached->decrement($id, $offset);
+ if (($result = $this->_memcached->decrement($id, $offset)) === FALSE)
+ {
+ return $this->_memcached->add($id, 0) ? 0 : FALSE;
+ }
+
+ return $result;
}
// ------------------------------------------------------------------------