TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Caching question (http://www.talkphp.com/absolute-beginners/2160-caching-question.html)

Brook 01-31-2008 06:16 PM

Caching question
 
Is it possible to create a caching script that can cache pages that are dynamicly created?

For eg, If each page in a certain section is created by a variable in the url: mysite.com/games?=game_id

Where game_id tells the script what to fetch from the DB for that page.

I don't nesc need to know how to do it, just if it is possible and on what scale of the difficulty meter it would sit on.

I need to factor it into what platform I am going to use for my next site.

(I guess it must be possible as vB can cache posts/threads?)

Cheers,

Salathe 01-31-2008 06:59 PM

Yes it's possible to cache based on the request url, and it's a fairly simple task to achieve.

Brook 01-31-2008 07:07 PM

Ah right thanks Salathe.

Just out of interest what would be involved? (roughly)

Thanks!

Salathe 01-31-2008 07:16 PM

There are two things involved mainly. Firstly, grabbing the page's uri which you might use $_SERVER['REQUEST_URI'] as a starting point. Secondly, to grab the page's finished HTML you would want to use output buffering with a callback function/method to save a cache file.

Of course, things can be made much more complex if you wish or if your requirements dictate it.

Brook 01-31-2008 07:19 PM

Ah k thanks.

That makes me feel better as one of the main reasons I was going to go with Drupal was because of page caching.. but if I can get page caching built in at a later date on more of a custom route that's good news.

WinSrev 02-03-2008 05:40 AM

An easy route to "cache" a page would be to use a PHP module such as eAccelerator which caches the page and updates it on change.

cosmok 02-03-2008 08:29 PM

or u can use PEARs cache_lite PEAR :: Package :: Cache_Lite


All times are GMT. The time now is 01:58 AM.

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