Jump to content

Good Caching Method


upgrader

Recommended Posts

Hi there, I've never really done any caching at all so I'm looking for suggestions for caching the results of this script so that instead of it running everytime the page loads it only say once every hour.

 

   
                                      $html = file_get_contents('http://badhausen.hlstatsx.com/?mode=players&game=css');
   
                                      $dom = new domDocument;
   
                                      $dom->loadHTML($html);
   
                                      $dom->preserveWhiteSpace = false;
   
                                     
   
                                      $x = new DomXPath($dom);                                     
   
                                      $results = $x->query('//table/tr[position() >= 2 and position() <= 4]/td[2]/font/a');
                                     
  
                                      foreach ($results as $result) {  
                                              echo "<li>".$result->nodeValue."</li>\n";  
                                              }

Link to comment
Share on other sites

Try do Google with "caching with php".

 

 

Thanks for your input... notice how I was asking for a good caching method in this situation...

 

@dreamwest: what does that do etc? Could you explain it?

 

It caches everything with the filesmatch extension. max-age is in seconds

Link to comment
Share on other sites

Try do Google with "caching with php".

 

 

Thanks for your input... notice how I was asking for a good caching method in this situation...

 

@dreamwest: what does that do etc? Could you explain it?

 

Will Cache_lite help you? A good article is at:

www.devshed.com/c/a/PHP/Caching-With-PHP-Cache-Lite

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.