diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-11-20 14:09:46 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-11-20 14:09:46 +0100 |
commit | a2b06771202365af678df478eab4e68aa7006d68 (patch) | |
tree | 723f7a745e97a5a474eb937cfd95383af677552a /system | |
parent | 52e7b2465c42839e95e0c7fa91fb0373d34b7a4e (diff) |
Fix #18
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Cache/drivers/Cache_apc.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php index 46e633463..a9ad6ed19 100644 --- a/system/libraries/Cache/drivers/Cache_apc.php +++ b/system/libraries/Cache/drivers/Cache_apc.php @@ -48,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; } // ------------------------------------------------------------------------ @@ -67,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); } // ------------------------------------------------------------------------ @@ -118,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; } @@ -130,7 +133,7 @@ class CI_Cache_apc extends CI_Driver { return array( 'expire' => $time + $ttl, 'mtime' => $time, - 'data' => $data + 'data' => unserialize($data) ); } |