TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-31-2008, 05:16 PM   #1 (permalink)
The Acquainted
Inquisitive 
 
Join Date: Jul 2005
Location: UK
Posts: 121
Thanks: 41
Brook is on a distinguished road
Default 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,
__________________
PS3 Forums on GameSlurp - the site for gaming fans!
Brook is offline  
Reply With Quote
Old 01-31-2008, 05:59 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
Salathe is on a distinguished road
Default

Yes it's possible to cache based on the request url, and it's a fairly simple task to achieve.
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
Brook (01-31-2008)
Old 01-31-2008, 06:07 PM   #3 (permalink)
The Acquainted
Inquisitive 
 
Join Date: Jul 2005
Location: UK
Posts: 121
Thanks: 41
Brook is on a distinguished road
Default

Ah right thanks Salathe.

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

Thanks!
__________________
PS3 Forums on GameSlurp - the site for gaming fans!
Brook is offline  
Reply With Quote
Old 01-31-2008, 06:16 PM   #4 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,381
Thanks: 5
Salathe is on a distinguished road
Default

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.
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
Brook (01-31-2008)
Old 01-31-2008, 06:19 PM   #5 (permalink)
The Acquainted
Inquisitive 
 
Join Date: Jul 2005
Location: UK
Posts: 121
Thanks: 41
Brook is on a distinguished road
Default

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.
__________________
PS3 Forums on GameSlurp - the site for gaming fans!
Brook is offline  
Reply With Quote
Old 02-03-2008, 04:40 AM   #6 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Default

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.
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
The Following User Says Thank You to WinSrev For This Useful Post:
Brook (02-03-2008)
Old 02-03-2008, 07:29 PM   #7 (permalink)
The Contributor
 
Join Date: Jan 2008
Posts: 25
Thanks: 8
cosmok is on a distinguished road
Default

or u can use PEARs cache_lite PEAR :: Package :: Cache_Lite
cosmok is offline  
Reply With Quote
The Following User Says Thank You to cosmok For This Useful Post:
Brook (02-07-2008)
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:54 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design