<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.14.1">
</HEAD>
<BODY>
On Mon, 2007-09-10 at 14:24 +0800, J A wrote:
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">I've read that it's not good to use Memcache to cache MySQL queries, as the MySQL buffer already does this. Instead, I should cache the html output. Is this what one should always do?</FONT><BR>
</BLOCKQUOTE>
MySQL does indeed cache query data, but I believe this gets invalidated when the table is updated. We use ADODB as an abstraction layer, and this allows easy memcaching of query results out of the box.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000"> </FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">I'm running PHP and using Smarty for templates. The PHP throws the output to Smarty, and Smarty is the thing that outputs the html. Thus my application is not able to grab the html output. Or is there a way to do it?</FONT><BR>
</BLOCKQUOTE>
You might like to investigate basic Smarty caching using the filesystem, unless theres a particular reason you need to use memcache. It would be reasonably simple to adapt Smarty filecaching to memcache, however.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000"> </FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">For instance, in a page I might have a "about us" section, a "friends list", and a "blog list". I'd like to cache each of those sections.</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000"> </FONT><BR>
</BLOCKQUOTE>
Smarty will compile each of these sections individually and then cache the page as a whole. There's not currently (AFAIK) template-level caching in Smarty, but one of my co-workers has a working implementation that we're testing.<BR>
<BR>
Hope that helps a little,<BR>
Rob.<BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<TABLE CELLSPACING="3" CELLPADDING="0" WIDTH="100%">
<TR>
<TD COLSPAN="2" VALIGN="top">
<B><FONT SIZE="2"><FONT COLOR="#333333">Rob Sharp</FONT></FONT></B><BR>
<FONT SIZE="1"><FONT COLOR="#ce4a84">Development Lead </FONT></FONT><BR>
<BR>
<B><FONT SIZE="1">telephone:</FONT></B><FONT SIZE="1"> 02 9282 4038</FONT><BR>
<B><FONT SIZE="1">facsimile:</FONT></B><FONT SIZE="1"> 02 9282 4099</FONT><BR>
<B><FONT SIZE="1">skype:</FONT></B><FONT SIZE="1"> qu4nnum</FONT><BR>
<BR>
<BR>
<BR>
<BR>
</TD>
</TR>
<TR>
<TD COLSPAN="2" VALIGN="top">
<FONT SIZE="2"><FONT COLOR="#333333">Sound Alliance </FONT></FONT><BR>
<FONT SIZE="1"><FONT COLOR="#ce4a84">inthemix : FasterLouder : Thought By Them : SameSame</FONT></FONT>
</TD>
</TR>
</TABLE>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>