Current location: Hot Scripts Forums » Programming Languages » PHP » How important is caching?


How important is caching?

Reply
  #1 (permalink)  
Old 07-22-05, 10:26 AM
mattpointblank mattpointblank is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
How important is caching?

I'm writing my own Content Management System, originally from a tutorial. The tutorial had a section about caching a page that has the format page.php?id=345. This works quite well, but I have a problem now I'm adding a hit counter to the pages. It's an internal counter that just updates the value of 'Hits' in the article table by 1 (if the user is on a new session). This code doesn't work probably with the caching system, it seems to only log one hit and then no more, for any of the page IDs. I was wondering how important caching a page like this would be? Is it likely to save that much bandwidth (we currently get around 20,000 hits per month) if I cache the page? Alternatively, is there a better way to update the hits that I haven't thought of?
Reply With Quote
  #2 (permalink)  
Old 07-24-05, 04:47 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

You see, caching is very interesting and challenging topic. Usuallly caching is referred to sending a couple of headers that tell the browser to keep the page cached and redisplay it on the following requests for a certain period of time. If you explicitly instruct the browser that your particular page has a life time period of 2 days then the user will see the cached version for these two days as the browser will not reload it from the server. In such scenario your script will not be able to detect page hits.

Relatively new trend is to employ server side caching. It has certain benefits as one cache can serve multiple visitors from different locations. However, with the server side caching you will still have to server every request - you just save time generating the page. If you still need counting you may want to consider using server caching to update counters and return the cached content.

You may also wish to take a look at the Freeform farmework which has excellent 3 level caching support starting with ver. 1.2.0
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
stop caching Bazzio PHP 1 05-16-05 06:43 AM
Some freeware panels like Cpanel??? IMPORTANT!! gardar Script Requests 1 04-22-05 11:06 AM
Webmaster Read Here - Important - tuxedo General Advertisements 0 02-19-05 03:22 AM
Please give me your suggestions on this site - Its important v1brazy Website Reviews 2 10-24-04 10:17 PM
Important MySQL bugs moronovich PHP 0 10-20-04 09:27 AM


All times are GMT -5. The time now is 06:57 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.