<!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>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">On 10 Sep 2007, at 08:50, Rob Sharp wrote:</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">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.</FONT>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">That's not true. Smarty caches whole templates, but one template can be included in another, hence you can get selective caching of page elements. Read the docs carefully as it's quite fiddly: <A HREF="http://smarty.php.net/manual/en/caching.php">http://smarty.php.net/manual/en/caching.php</A></FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">In particular notice {insert}, and also that plugins can choose whether their output is cached.</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
Ah, I see what you mean. We use include in preference to fetch - for variable scoping reasons - and that means we only have page-level caching. Obviously using fetch has the caching advantage, but requires explicit variable assignment over a global scope.<BR>
<BR>
Back to memcache, this is a smarty example of the plugin we're using to cache templates in memcache:<BR>
<BR>
<TT> {cacheBlock cacheHashData=$digestItem timeout=60 include="comps/apps/digest/entry.tpl"}</TT><BR>
<BR>
'cachehashData' is both passed into the template, and used to uniquify the key, and 'include' is the template to load<BR>
<BR>
It's very simple, but solves a common problem for us. Ideally the TTL would be abstracted from the templates, but this is a 10 minute fix that's still under development. We've yet to benchmark, but the template in question is incredibly data-intensive (it retrieves activity digest data for a given user), so it works a treat for our situation.<BR>
<BR>
Is anyone using something similar, or have a better approach to that issue?<BR>
<BR>
Regards,<BR>
Rob.<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">Marcus</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">-- </FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">Marcus Bointon</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">Synchromedia Limited: Creators of http://www.smartmessages.net/</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">UK resellers of info@hand CRM solutions</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000">marcus@synchromedia.co.uk | http://www.synchromedia.co.uk/</FONT>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<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>