<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Tangled in the Template Cache</title>
	<atom:link href="http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/</link>
	<description>Music, Politics and Code</description>
	<pubDate>Sat, 26 Jul 2008 02:59:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Stake Five :: WHENTO: Evaluate() and Iif()</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-69</link>
		<dc:creator>Stake Five :: WHENTO: Evaluate() and Iif()</dc:creator>
		<pubDate>Mon, 24 Jul 2006 11:51:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-69</guid>
		<description>[...] Bert brought up a rather interesting scenario where he needed to force templates to be reloaded into the template cache, since he was generating bits of CFML code at runtime. I suggested that he might also want to take a look at the evaluate() function, since that would probably allow him to solve his problem in a simpler manner. [...]</description>
		<content:encoded><![CDATA[<p>[...] Bert brought up a rather interesting scenario where he needed to force templates to be reloaded into the template cache, since he was generating bits of CFML code at runtime. I suggested that he might also want to take a look at the evaluate() function, since that would probably allow him to solve his problem in a simpler manner. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashwin</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-68</link>
		<dc:creator>ashwin</dc:creator>
		<pubDate>Fri, 21 Jul 2006 16:30:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-68</guid>
		<description>Ok, so the solution is simpler than my befuddled end-of-week head could come up with earlier... could you just stick the label strings in a property file, and then use evaluate() on them from your templates? That all depends on performance, of course; depending on how many labels you have, what you're doing right now might indeed be the best approach. More arguments in favour of a cache-me-not directive.</description>
		<content:encoded><![CDATA[<p>Ok, so the solution is simpler than my befuddled end-of-week head could come up with earlier&#8230; could you just stick the label strings in a property file, and then use evaluate() on them from your templates? That all depends on performance, of course; depending on how many labels you have, what you&#8217;re doing right now might indeed be the best approach. More arguments in favour of a cache-me-not directive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashwin</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-67</link>
		<dc:creator>ashwin</dc:creator>
		<pubDate>Fri, 21 Jul 2006 11:59:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-67</guid>
		<description>Yes, CF will still do the "has it changed" check, reinitialization is not for the templates in the cache, just for some odd bits of config that stick out of it.

I think there is an easier way out though... I'll play around a bit and post something up shortly.</description>
		<content:encoded><![CDATA[<p>Yes, CF will still do the &#8220;has it changed&#8221; check, reinitialization is not for the templates in the cache, just for some odd bits of config that stick out of it.</p>
<p>I think there is an easier way out though&#8230; I&#8217;ll play around a bit and post something up shortly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bert Dawson</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-66</link>
		<dc:creator>Bert Dawson</dc:creator>
		<pubDate>Fri, 21 Jul 2006 11:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-66</guid>
		<description>middle section in previous post should read:

I can’t just store the labels in memory since it is possible to have runtime variables embedded in the labels: e.g when editting myLabel in myTemplate, an admin user could enter:
“the time is &#60;label_output theTime&#62;”
which gets saved to the cfm file as:
myTemplate.myLabel = “the time is #labelOutput(’theTime’)#”;</description>
		<content:encoded><![CDATA[<p>middle section in previous post should read:</p>
<p>I can’t just store the labels in memory since it is possible to have runtime variables embedded in the labels: e.g when editting myLabel in myTemplate, an admin user could enter:<br />
“the time is &lt;label_output theTime&gt;”<br />
which gets saved to the cfm file as:<br />
myTemplate.myLabel = “the time is #labelOutput(’theTime’)#”;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bert Dawson</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-65</link>
		<dc:creator>Bert Dawson</dc:creator>
		<pubDate>Fri, 21 Jul 2006 11:40:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-65</guid>
		<description>The situation is that I store "labels" as structures in cfm files. The labels are editable via an admin front end. On a page which needs labels, the apropriate cfm page is included, and the labels displayed appropriately (all via functions).
The sites are also multi-lingual.
By labels, i mean the sort of thing which is normally hardcoded in the template. e.g. In this comment form there's a heading "Post a comment", a sentance about "your email is never published...", then all the labels for the form fields. They would each be separate labels.

I can't just store the labels in memory since it is possible to have runtime variables embedded in the labels: e.g when editting myLabel in  myTemplate, an admin user could enter:
"the time is "
which gets saved to the cfm file as:
myTemplate.myLabel = "the time is #labelOutput('theTime')#";

So currently I can't turn on trusted cache because it would mean any changes made to the labels will not get picked up.

But if i can save the .cfm file, turn off the trusted cache, invoke the saved file (probably via an include in custom tag to give it its own scope), then turn trusted cache back on, all in a supported way, i'd be laughing.

And presumably while trusted cache is turned off, i will be no worse off than i am currently: CF won't need to re-initialise the whole cache will it? It'll just be the files which are hit while caching is off, and even then CF will just be doing the same "has it changed" check that it does when trusted cache is turned off permenantly, right?</description>
		<content:encoded><![CDATA[<p>The situation is that I store &#8220;labels&#8221; as structures in cfm files. The labels are editable via an admin front end. On a page which needs labels, the apropriate cfm page is included, and the labels displayed appropriately (all via functions).<br />
The sites are also multi-lingual.<br />
By labels, i mean the sort of thing which is normally hardcoded in the template. e.g. In this comment form there&#8217;s a heading &#8220;Post a comment&#8221;, a sentance about &#8220;your email is never published&#8230;&#8221;, then all the labels for the form fields. They would each be separate labels.</p>
<p>I can&#8217;t just store the labels in memory since it is possible to have runtime variables embedded in the labels: e.g when editting myLabel in  myTemplate, an admin user could enter:<br />
&#8220;the time is &#8221;<br />
which gets saved to the cfm file as:<br />
myTemplate.myLabel = &#8220;the time is #labelOutput(&#8217;theTime&#8217;)#&#8221;;</p>
<p>So currently I can&#8217;t turn on trusted cache because it would mean any changes made to the labels will not get picked up.</p>
<p>But if i can save the .cfm file, turn off the trusted cache, invoke the saved file (probably via an include in custom tag to give it its own scope), then turn trusted cache back on, all in a supported way, i&#8217;d be laughing.</p>
<p>And presumably while trusted cache is turned off, i will be no worse off than i am currently: CF won&#8217;t need to re-initialise the whole cache will it? It&#8217;ll just be the files which are hit while caching is off, and even then CF will just be doing the same &#8220;has it changed&#8221; check that it does when trusted cache is turned off permenantly, right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashwin</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-64</link>
		<dc:creator>ashwin</dc:creator>
		<pubDate>Fri, 21 Jul 2006 10:08:14 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-64</guid>
		<description>Bert, toggling the trusted cache switch every 5 mins should be ok. However, keep in mind that you will pay a cost (shouldn't be too large) in terms of some cache reinitialization on every toggle. 5 mins does seem a little extreme though - what's your scenario? Oh, and as I noted in an earlier comment, remember that you will need to make actual requests to any changed templates for them to be recompiled and loaded into the cache while the trusted cache flag is turned off. Simply toggling the flag will have no effect.
In general, it's preferred that you use the Admin API - runtime.cfc provides a setCacheProperty() function for this purpose - that is the supported mechanism... which is not to say that invoking the factory method will not work, just that it's not officially supported.</description>
		<content:encoded><![CDATA[<p>Bert, toggling the trusted cache switch every 5 mins should be ok. However, keep in mind that you will pay a cost (shouldn&#8217;t be too large) in terms of some cache reinitialization on every toggle. 5 mins does seem a little extreme though - what&#8217;s your scenario? Oh, and as I noted in an earlier comment, remember that you will need to make actual requests to any changed templates for them to be recompiled and loaded into the cache while the trusted cache flag is turned off. Simply toggling the flag will have no effect.<br />
In general, it&#8217;s preferred that you use the Admin API - runtime.cfc provides a setCacheProperty() function for this purpose - that is the supported mechanism&#8230; which is not to say that invoking the factory method will not work, just that it&#8217;s not officially supported.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bert Dawson</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-63</link>
		<dc:creator>Bert Dawson</dc:creator>
		<pubDate>Fri, 21 Jul 2006 09:45:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-63</guid>
		<description>Ashwin, with regards to turning on and off TrustedCache programatically, when i say "...but is it a good idea?" I mean in terms of server stability.
Is this sort of use of the factory supported?
Would you foresee any problems in switching this off and on in a production environment say every five minutes?</description>
		<content:encoded><![CDATA[<p>Ashwin, with regards to turning on and off TrustedCache programatically, when i say &#8220;&#8230;but is it a good idea?&#8221; I mean in terms of server stability.<br />
Is this sort of use of the factory supported?<br />
Would you foresee any problems in switching this off and on in a production environment say every five minutes?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Guill</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-62</link>
		<dc:creator>Ryan Guill</dc:creator>
		<pubDate>Thu, 20 Jul 2006 12:13:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-62</guid>
		<description>There doesn't seem to be anything special about the pages.  We are currently running cf 7.0.0, but we have plans to update to 7.0.2.  I think you are probably correct with the updating of the timestamp, I had thought that it also could be that we are changing the size of the file which is forcing cf or IIS one to notice that it is an updated file.

Im not surprised that you couldn't reproduce it, I can't reproduce it myself intentionally, it just seems to happen periodically.</description>
		<content:encoded><![CDATA[<p>There doesn&#8217;t seem to be anything special about the pages.  We are currently running cf 7.0.0, but we have plans to update to 7.0.2.  I think you are probably correct with the updating of the timestamp, I had thought that it also could be that we are changing the size of the file which is forcing cf or IIS one to notice that it is an updated file.</p>
<p>Im not surprised that you couldn&#8217;t reproduce it, I can&#8217;t reproduce it myself intentionally, it just seems to happen periodically.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashwin</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-61</link>
		<dc:creator>ashwin</dc:creator>
		<pubDate>Thu, 20 Jul 2006 10:24:59 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-61</guid>
		<description>Ryan, I've been unable to reproduce the behaviour you describe. What version of CF are you running? Is there anything special about the template that goes 404? I would suspect that all that the extra whitespace is doing is forcing a file write so that the timestamp gets updated.</description>
		<content:encoded><![CDATA[<p>Ryan, I&#8217;ve been unable to reproduce the behaviour you describe. What version of CF are you running? Is there anything special about the template that goes 404? I would suspect that all that the extra whitespace is doing is forcing a file write so that the timestamp gets updated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashwin</title>
		<link>http://blogs.sanmathi.org/ashwin/2006/07/13/tangled-in-the-template-cache/#comment-60</link>
		<dc:creator>ashwin</dc:creator>
		<pubDate>Thu, 20 Jul 2006 07:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.sanmathi.org/ashwin/?p=33#comment-60</guid>
		<description>Bert - you could do that, but you'd have to make sure that the changed pages were hit at least once so that they get recompiled and loaded (perhaps a CFHTTP call) before turning trusted cache back on again. Another approach might be to again dynamically include the HTML snippets by simply reading them off the file system (no in-memory cache), and then use CFCACHE on the CFM with a timeout equal to the time between regenerations of the HTML snippet files. You could then still keep trusted cache on, and get (potentially!) huge performance benefits.</description>
		<content:encoded><![CDATA[<p>Bert - you could do that, but you&#8217;d have to make sure that the changed pages were hit at least once so that they get recompiled and loaded (perhaps a CFHTTP call) before turning trusted cache back on again. Another approach might be to again dynamically include the HTML snippets by simply reading them off the file system (no in-memory cache), and then use CFCACHE on the CFM with a timeout equal to the time between regenerations of the HTML snippet files. You could then still keep trusted cache on, and get (potentially!) huge performance benefits.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
