On Thu, Jun 5, 2008 at 10:16 AM, VamVan <[EMAIL PROTECTED]> 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

Reply via email to