it is similar to the template engine cache function. The only difference is that in template engine such as smarty, we can define which block of contents should be ignore by the cacheing mechanism.
In codeigniter, it will keep the cached the contents based on the definition of $x as time in minutes.
$this->output->cache($x); // $x is the number of minutes
Only use this function outside the form, login form, user's account page, administration page and other contents where login authentication is required.
If you will be using this function, it is helpful to create a purging script or class to give you the option to purge the cached content on demand without manually deleting them.
It is useful in delivering contents that don't change a lot. For example, a front page with content from the database that don't change a lot can use the cache function. It will definitely saves a great deal of server resources by just loading the cache page rather than executing a database fetch queries for the contents.
Firstly, it caches the entire fully-rendered page, which means that it isn't a good solution for logged in pages that are user-specific, because you can't use it to cache just a portion of a page.
Secondly, the file cache gets stored in the file system, so make sure you aren't caching hundreds of thousands of pages, because that can significantly slow things down instead of speed them up. And I believe there's a max limit to how many pages can be stored in a single directory depending on the file system, as well.
Thirdly, a limitation of CI's built in file caching system is that it is hardcoded to only spit out HTML files. I actually had to modify it myself to allow the caching of other mime types, so that I could use it for our RSS feeds, for example (which, IMO, is a very good use of file caching!)
Sounds like if the page or queries need to be updated you could cause an issue with caching so I think I'm going to avoid this as I don't really know which db queries remain constant or pages remain unchanged for the time being.
Well that's the trade-off with any caching mechanism ... faster in exchange for potentially stale content.
We use Memcached very heavily to cache database queries and things of that sort. We use an adapted version of CodeIgniter's caching mechanism, which is capable of handling any mime type, to cache our RSS feeds, API calls that don't use an OAuth token, and our tag clouds (which rarely change). We can cache our tag clouds, even though they're just a portion of the page, because they're injected via an IFRAME ... err, actually, using jQuery.load(), but same difference.