I'm setting up the foundation for an application with a rapidly expanding database. Currently with only around 12000 users there's already a table with over 5 million record fields. This is starting to up the times queries in get executed a lot. Therefore I started thinking about caching either queries or the entire pages for a limited time (say 30 minutes, maybe an hour).
I've read up a lot about the caching options of CodeIgniter (v2.1.4) throughout the user-guide (here, here and here for example) and throughout a bunch of forums and SO questions about caching.
I also read up a little bit about Memcached and APC methods of caching. Based on comments and differences I'd like to use APC Caching.
So, does caching a page also include all of the data required to make up the page content? Or do the queries get executed each time a cached page is to be served up?
If the latter, how can I cache the query results for a limited time (say the before mentioned 30 or 60 minutes) to prevent the database becoming too busy?
The preferred situation would be to be able to store complete pages and have them refreshed (also without a user request for the page) every time a timer runs down. The page would of course include new data from a query as well.