summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers/Cache_apc.php
diff options
context:
space:
mode:
authorEric Roberts <eric@cryode.com>2012-12-12 14:02:11 +0100
committerEric Roberts <eric@cryode.com>2012-12-12 14:02:11 +0100
commitb9e35f21e1c70b6aa67c47e9244ed83195abc00a (patch)
tree64f82db362deeac48cc20d1d1afd80651f36f5a5 /system/libraries/Cache/drivers/Cache_apc.php
parent0b05705c52c3bca7f9b3aee657c888e8ad1ff422 (diff)
parent545a7c86701875e1412bcde316e9bcc76d9a23a0 (diff)
Merge branch 'refs/heads/develop' into feature/form_error_msgs
Conflicts: system/language/english/form_validation_lang.php user_guide_src/source/libraries/form_validation.rst Signed-off-by: Eric Roberts <eric@cryode.com>
Diffstat (limited to 'system/libraries/Cache/drivers/Cache_apc.php')
-rw-r--r--system/libraries/Cache/drivers/Cache_apc.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index 59ab67533..a9ad6ed19 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php
/**
* CodeIgniter
*
@@ -18,12 +18,13 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 2.0
* @filesource
*/
+defined('BASEPATH') OR exit('No direct script access allowed');
/**
* CodeIgniter APC Caching Class
@@ -47,9 +48,11 @@ class CI_Cache_apc extends CI_Driver {
*/
public function get($id)
{
- $data = apc_fetch($id);
+ $success = FALSE;
+ $data = apc_fetch($id, $success);
- return is_array($data) ? $data[0] : FALSE;
+ return ($success === TRUE && is_array($data))
+ ? unserialize($data[0]) : FALSE;
}
// ------------------------------------------------------------------------
@@ -66,7 +69,7 @@ class CI_Cache_apc extends CI_Driver {
public function save($id, $data, $ttl = 60)
{
$ttl = (int) $ttl;
- return apc_store($id, array($data, time(), $ttl), $ttl);
+ return apc_store($id, array(serialize($data), time(), $ttl), $ttl);
}
// ------------------------------------------------------------------------
@@ -75,7 +78,7 @@ class CI_Cache_apc extends CI_Driver {
* Delete from Cache
*
* @param mixed unique identifier of the item in the cache
- * @param bool true on success/false on failure
+ * @return bool true on success/false on failure
*/
public function delete($id)
{
@@ -117,9 +120,10 @@ class CI_Cache_apc extends CI_Driver {
*/
public function get_metadata($id)
{
- $stored = apc_fetch($id);
+ $success = FALSE;
+ $stored = apc_fetch($id, $success);
- if (count($stored) !== 3)
+ if ($success === FALSE OR count($stored) !== 3)
{
return FALSE;
}
@@ -129,7 +133,7 @@ class CI_Cache_apc extends CI_Driver {
return array(
'expire' => $time + $ttl,
'mtime' => $time,
- 'data' => $data
+ 'data' => unserialize($data)
);
}