PHP: File Cache vs Database

Hey I am wondering which would cause least stress on Dreamhost servers.

a) All data loaded from database (roughly 2-4 queries per page)
b) Initially load data from database then cache into text file. When data is changed cache file is deleted then recreated when page is viewed again.
c) Load data from database and cache into text file but set the expiry (to make it load from the database again) to a short period of time (hours or days).This method deletes the cache file when the page is loaded. So it will be there until the page is loaded again (even after the expiry date)
d) any other method you can think of.

As far as all the coding its not a problem all methods are pretty much the same amount of coding. I am more looking to which will perform better on Dreamhost servers if the website becomes popular and had a fair amount of traffic.

Thanks any help is appreciated.

  • Matt

Not totally sure, but file I/O will have a problem as the homes are mounted via nfs… a friend got on big problems with a rails app he wrote (ran too slow), on the other side, mysql with mysam (not innodb), maybe is better… but take in mind last program I wrote was on fortran. :smiley:

Somewhere, something incredible is waiting to be known.

The best caching systems I’ve seen cache to static pages on first load and recache on edit.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost

Thanks for the replys.
Does anyone know how I can contact dreamhost admins just to query about this rather then ask for help with a problem. (options in support seem to only be if there is a problem rather then just a general query).

  • Matt

Via a ticket on the support tab on the panel or email to support at dreamhost dot com, the first one is the faster and preferred option.

Somewhere, something incredible is waiting to be known.