summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers/Cache_file.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-06-06 23:08:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-06-06 23:08:59 +0200
commit77f15dc6ba5d3308d42e8f75103c3193d3796dd2 (patch)
tree7e1a86f8b0ff954780a28bdea6c956649cf36d57 /system/libraries/Cache/drivers/Cache_file.php
parent110b467503f7a749aec685be445468c0f98b9e2a (diff)
parent916b176594bcf175417423f33711ac0cbb4082e7 (diff)
Merge remote-tracking branch 'remotes/upstream/2.2-stable' into working
Signed-off-by: Florian Pritz <bluewind@xinu.at> Conflicts: system/libraries/Session.php user_guide/
Diffstat (limited to 'system/libraries/Cache/drivers/Cache_file.php')
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php38
1 files changed, 18 insertions, 20 deletions
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index e515eebf1..50602b4b8 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -2,27 +2,27 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 4.3.2 or newer
+ * An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2006 - 2012 EllisLab, Inc.
+ * @copyright Copyright (c) 2006 - 2014 EllisLab, Inc.
* @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'])
{
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
- * - Default is 60 seconds
+ * @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);
@@ -179,7 +179,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()
@@ -187,9 +187,7 @@ class CI_Cache_file extends CI_Driver {
return is_really_writable($this->_cache_path);
}
- // ------------------------------------------------------------------------
}
-// End Class
/* End of file Cache_file.php */
/* Location: ./system/libraries/Cache/drivers/Cache_file.php */ \ No newline at end of file