Fixed a bug (4718) in which the path to the files was being set in correctly.
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index ecb2b13..9bb1b16 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -93,13 +93,14 @@
 		{

 			return $this->db->cache_off();

 		}

+

+		$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);

+		

+		$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);

 	

-		$uri  = ($this->CI->uri->segment(1) == FALSE) ? 'default.'	: $this->CI->uri->segment(1).'+';

-		$uri .= ($this->CI->uri->segment(2) == FALSE) ? 'index'		: $this->CI->uri->segment(2);

+		$filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql);		

 		

-		$filepath = $uri.'/'.md5($sql);

-		

-		if (FALSE === ($cachedata = read_file($this->db->cachedir.$filepath)))

+		if (FALSE === ($cachedata = read_file($filepath)))

 		{	

 			return FALSE;

 		}

@@ -122,10 +123,11 @@
 			return $this->db->cache_off();

 		}

 

-		$uri  = ($this->CI->uri->segment(1) == FALSE) ? 'default.'	: $this->CI->uri->segment(1).'+';

-		$uri .= ($this->CI->uri->segment(2) == FALSE) ? 'index'		: $this->CI->uri->segment(2);

+		$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);

 		

-		$dir_path = $this->db->cachedir.$uri.'/';

+		$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);

+	

+		$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';

 		

 		$filename = md5($sql);