TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   How do you 'cache' a page? (http://www.talkphp.com/general/196-how-do-you-cache-page.html)

Brook 02-24-2007 07:49 PM

How do you 'cache' a page?
 
I have a few pages that run about 15 queries, now I know that's not much but I'd like to expand on the page so it runs double that :eek:

So I was wondering if it would be possible to cache a version, or part of, the page and display that instead? And maybe the cache is refreshed every ten minutes or so.

Is it possible?

Is it easy? :confused:

Any help appreciated!

mikem 02-27-2007 03:36 PM

You could store a copy of the generated page in the database or in a text file then just load that copy as needed instead of generating the page for each view.

To update the page you could do that whenever one of the values shown on the page is changed (ie: inserting/deleting/updating a row that would change the cached page).

Another option might be storing the time that the cached page was generated. When fetching the page, determine if the time is more than x minutes in the past. If so, then regenerate the page, update the last generated time and continue on as normal.


All times are GMT. The time now is 12:06 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0