Re: Caching and Optimization

From: Date: Thu, 05 Jun 2008 17:50:19 +0000
Subject: Re: Caching and Optimization
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-275072@lists.php.net to get a copy of this message
On Thu, Jun 5, 2008 at 10:16 AM, VamVan <vamseevan@gmail.com> wrote: > Hello All, > > Today my question is about the all important topic "Web Optimization" > > What kind of caching mechanisms can I use for Mysql Queries? mysql has its own caching support, worth looking into. you can also cache query results on the webserver. there you have a variety of mediums to save the queries in, files (session perhaps), apc, memcache, etc.. > What kind of caching and optimization mechanisms can I use for frequent Web > Service calls? typically, reverse proxies are used for this purpose. squid is very popular, also, in apache 2.2 mod_proxy + mod_cache is looking pretty sweet ;) Any kind of code explaining the process would be highly appreciated... > the only place in here you would need any php code would be caching sql queries on the webserver. its not too difficult really (but there is a large gradient of complexity), here is a super trivial example, $query = 'some sql'; if(in_cache($query)) return fetch_from_cache($query); else { $resultSet = mysql_query($query); store_in_cache($query, $resultSet); return $resultSet; } -nathan

« previous php.general (#275072) next »