summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries/Cache')
-rw-r--r--system/libraries/Cache/drivers/Cache_apc.php8
-rw-r--r--system/libraries/Cache/drivers/Cache_apcu.php8
-rw-r--r--system/libraries/Cache/drivers/Cache_dummy.php8
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php48
-rw-r--r--system/libraries/Cache/drivers/Cache_wincache.php8
-rw-r--r--system/libraries/Cache/drivers/index.html2
-rw-r--r--system/libraries/Cache/index.html2
7 files changed, 60 insertions, 24 deletions
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index 8da8854ee..c0527e665 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -160,10 +160,10 @@ class CI_Cache_apc extends CI_Driver {
* @param string user/filehits
* @return mixed array on success, false on failure
*/
- public function cache_info($type = NULL)
- {
- return apc_cache_info($type);
- }
+ public function cache_info($type = NULL)
+ {
+ return apc_cache_info($type);
+ }
// ------------------------------------------------------------------------
diff --git a/system/libraries/Cache/drivers/Cache_apcu.php b/system/libraries/Cache/drivers/Cache_apcu.php
index 0d84f8ee3..01f80e79b 100644
--- a/system/libraries/Cache/drivers/Cache_apcu.php
+++ b/system/libraries/Cache/drivers/Cache_apcu.php
@@ -171,10 +171,10 @@ class CI_Cache_apcu extends CI_Driver {
*
* @return mixed array on success, false on failure
*/
- public function cache_info()
- {
- return apcu_cache_info();
- }
+ public function cache_info()
+ {
+ return apcu_cache_info();
+ }
// ------------------------------------------------------------------------
diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php
index fdb9042ef..0a90d0692 100644
--- a/system/libraries/Cache/drivers/Cache_dummy.php
+++ b/system/libraries/Cache/drivers/Cache_dummy.php
@@ -138,10 +138,10 @@ class CI_Cache_dummy extends CI_Driver {
* @param string user/filehits
* @return bool FALSE
*/
- public function cache_info($type = NULL)
- {
- return FALSE;
- }
+ public function cache_info($type = NULL)
+ {
+ return FALSE;
+ }
// ------------------------------------------------------------------------
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index 3bc3ccd6c..9b082d11b 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -69,6 +69,21 @@ class CI_Cache_redis extends CI_Driver
*/
protected $_redis;
+
+ /**
+ * del()/delete() method name depending on phpRedis version
+ *
+ * @var string
+ */
+ protected static $_delete_name;
+
+ /**
+ * sRem()/sRemove() method name depending on phpRedis version
+ *
+ * @var string
+ */
+ protected static $_sRemove_name;
+
// ------------------------------------------------------------------------
/**
@@ -90,6 +105,20 @@ class CI_Cache_redis extends CI_Driver
return;
}
+ if ( ! isset(static::$_delete_name, static::$_sRemove_name))
+ {
+ if (version_compare(phpversion('redis'), '5', '>='))
+ {
+ static::$_delete_name = 'del';
+ static::$_sRemove_name = 'sRem';
+ }
+ else
+ {
+ static::$_delete_name = 'delete';
+ static::$_sRemove_name = 'sRemove';
+ }
+ }
+
$CI =& get_instance();
if ($CI->config->load('redis', TRUE, TRUE))
@@ -138,7 +167,7 @@ class CI_Cache_redis extends CI_Driver
{
$data = $this->_redis->hMGet($key, array('__ci_type', '__ci_value'));
- if ( ! isset($data['__ci_type'], $data['__ci_value']) OR $data['__ci_value'] === FALSE)
+ if ($value !== FALSE && $this->_redis->sIsMember('_ci_redis_serialized', $key))
{
return FALSE;
}
@@ -196,9 +225,9 @@ class CI_Cache_redis extends CI_Driver
{
return FALSE;
}
- elseif ($ttl)
+ else
{
- $this->_redis->expireAt($id, time() + $ttl);
+ $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $id);
}
return TRUE;
@@ -214,7 +243,14 @@ class CI_Cache_redis extends CI_Driver
*/
public function delete($key)
{
- return ($this->_redis->delete($key) === 1);
+ if ($this->_redis->{static::$_delete_name}($key) !== 1)
+ {
+ return FALSE;
+ }
+
+ $this->_redis->{static::$_sRemove_name}('_ci_redis_serialized', $key);
+
+ return TRUE;
}
// ------------------------------------------------------------------------
@@ -228,7 +264,7 @@ class CI_Cache_redis extends CI_Driver
*/
public function increment($id, $offset = 1)
{
- return $this->_redis->hIncrBy($id, 'data', $offset);
+ return $this->_redis->incrBy($id, $offset);
}
// ------------------------------------------------------------------------
@@ -242,7 +278,7 @@ class CI_Cache_redis extends CI_Driver
*/
public function decrement($id, $offset = 1)
{
- return $this->_redis->hIncrBy($id, 'data', -$offset);
+ return $this->_redis->decrBy($id, $offset);
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Cache/drivers/Cache_wincache.php b/system/libraries/Cache/drivers/Cache_wincache.php
index e19c6ca99..703fece7a 100644
--- a/system/libraries/Cache/drivers/Cache_wincache.php
+++ b/system/libraries/Cache/drivers/Cache_wincache.php
@@ -169,10 +169,10 @@ class CI_Cache_wincache extends CI_Driver {
*
* @return mixed array on success, false on failure
*/
- public function cache_info()
- {
- return wincache_ucache_info(TRUE);
- }
+ public function cache_info()
+ {
+ return wincache_ucache_info(TRUE);
+ }
// ------------------------------------------------------------------------
diff --git a/system/libraries/Cache/drivers/index.html b/system/libraries/Cache/drivers/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/libraries/Cache/drivers/index.html
+++ b/system/libraries/Cache/drivers/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>
diff --git a/system/libraries/Cache/index.html b/system/libraries/Cache/index.html
index b702fbc39..bcb7cae34 100644
--- a/system/libraries/Cache/index.html
+++ b/system/libraries/Cache/index.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="en">
<head>
<title>403 Forbidden</title>
</head>