[PHP] Caching Database Information

2004-08-25 Thread Paul Higgins
Hello all,
I have some questions regarding caching information with PHP.  I was 
thinking that I might cache all information that won't be changing for long 
periods of time...possibly only once a day or so, instead of querying the 
database for information every time.  My question is:  is there such as 
thing as too much caching?

Can I cache too much and therefore negate the advantages of caching?
Thanks,
Paul
_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Caching Database Information

2004-08-25 Thread Greg Donald
On Wed, 2004-08-25 at 14:52, Paul Higgins wrote:
 Hello all,
 
 I have some questions regarding caching information with PHP.  I was 
 thinking that I might cache all information that won't be changing for long 
 periods of time...possibly only once a day or so, instead of querying the 
 database for information every time.  My question is:  is there such as 
 thing as too much caching?
 
 Can I cache too much and therefore negate the advantages of caching?

As long as the overhead in caching remains less than the overhead in not
caching, I would say maybe.  :)

A single database query returns an array.  You use the array to build a
page.  You cache the page.  The cached version of the page gets hit 100
times.  Is the overhead in pulling the file from your cache 100 times
less than re-doing the query 100 times?  That depends.  Some databases
have query caching, and so do most file systems.  There are also PHP
caching tools like TurkeMM Cache and Zend that cache byte code only.

I'd bench it both ways and then decide based on the queries, the
development environment, and the cache timeout limitations/requirements.


-- 
Greg Donald

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Caching Database Information

2004-08-25 Thread Greg Donald
On Wed, 2004-08-25 at 16:32, Scott Hyndman wrote:
 I've found that caching LARGE datasets can be really useful. Filesystem
 access is blazing fast, and at least in my case, I've found it to be
 significantly faster than the time it takes to process a query and
 return the dataset.
 
 Too much caching? I don't think so. Just use it in the right places. You
 don't want to be caching something that needs to show change from second
 to second.

Just a hint.. You might try your Reply to all option next time. 
Especially since it's a list serve, and especially since I'm not the
poster of the original question.


-- 
Greg Donald

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Caching Database Information

2004-08-25 Thread raditha dissanayake
Paul Higgins wrote:
Hello all,
I have some questions regarding caching information with PHP.  I was 
thinking that I might cache all information that won't be changing for 
long periods of time...possibly only once a day or so, instead of 
querying the database for information every time.  My question is:  is 
there such as thing as too much caching?

Take a look at running Squid in httpd accelarator mode as well. Other 
options to look at include installing turck (this only caches the 
compiled version of the script - not the scripts output). also i believe 
there is an extension named memcached or something similar which may be 
what you want.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php