From eb2dcda02cd338f3230161b03ac4a55956b31bf9 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Sat, 2 Apr 2011 14:44:58 +0100 Subject: Added CI_ Prefix to the Cache driver. --- system/libraries/Cache/drivers/Cache_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 86d1a3b6a..13e2d1af6 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -25,7 +25,7 @@ * @link */ -class Cache_file extends CI_Driver { +class CI_Cache_file extends CI_Driver { protected $_cache_path; -- cgit v1.2.3-24-g4f1b From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001 From: Razican Date: Mon, 25 Apr 2011 17:26:45 +0200 Subject: Fixed double-space typo. --- system/libraries/Cache/drivers/Cache_file.php | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'system/libraries/Cache/drivers/Cache_file.php') diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php index 13e2d1af6..39dcd15c2 100644 --- a/system/libraries/Cache/drivers/Cache_file.php +++ b/system/libraries/Cache/drivers/Cache_file.php @@ -10,19 +10,19 @@ * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 2.0 - * @filesource + * @filesource */ // ------------------------------------------------------------------------ /** - * CodeIgniter Memcached Caching Class + * CodeIgniter Memcached Caching Class * * @package CodeIgniter * @subpackage Libraries * @category Core * @author ExpressionEngine Dev Team - * @link + * @link */ class CI_Cache_file extends CI_Driver { @@ -36,9 +36,9 @@ class CI_Cache_file extends CI_Driver { { $CI =& get_instance(); $CI->load->helper('file'); - + $path = $CI->config->item('cache_path'); - + $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; } @@ -56,16 +56,16 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - - if (time() > $data['time'] + $data['ttl']) + + if (time() > $data['time'] + $data['ttl']) { unlink($this->_cache_path.$id); return FALSE; } - + return $data['data']; } @@ -76,22 +76,22 @@ class CI_Cache_file extends CI_Driver { * * @param string unique key * @param mixed data to store - * @param int length of time (in seconds) the cache is valid + * @param int length of time (in seconds) the cache is valid * - Default is 60 seconds * @return boolean true on success/false on failure */ public function save($id, $data, $ttl = 60) - { + { $contents = array( 'time' => time(), - 'ttl' => $ttl, + 'ttl' => $ttl, 'data' => $data ); - + if (write_file($this->_cache_path.$id, serialize($contents))) { @chmod($this->_cache_path.$id, 0777); - return TRUE; + return TRUE; } return FALSE; @@ -116,7 +116,7 @@ class CI_Cache_file extends CI_Driver { * Clean the Cache * * @return boolean false on failure/true on success - */ + */ public function clean() { return delete_files($this->_cache_path); @@ -151,10 +151,10 @@ class CI_Cache_file extends CI_Driver { { return FALSE; } - - $data = read_file($this->_cache_path.$id); + + $data = read_file($this->_cache_path.$id); $data = unserialize($data); - + if (is_array($data)) { $data = $data['data']; @@ -170,7 +170,7 @@ class CI_Cache_file extends CI_Driver { 'mtime' => $mtime ); } - + return FALSE; } @@ -180,7 +180,7 @@ class CI_Cache_file extends CI_Driver { * Is supported * * In the file driver, check to see that the cache directory is indeed writable - * + * * @return boolean */ public function is_supported() -- cgit v1.2.3-24-g4f1b