Cache Template in Request Setting Explained

February 25, 2010
coldfusion

One of the new features added to ColdFusion 9 is the Cache Template in Request setting located on the Server Settings > Caching page of the ColdFusion Administrator. The setting was recently featured in the ColdFusion 9 Performance Brief showing a 50x boost when enabled. This has lead to a lot of questions, and confusion on how it actually works, and what it does.

The Cache Template in Request setting works similar to the Trusted Cache setting, but the cache is flushed at the end of the request. The setting is enabled by default in ColdFusion 9.

Cache Templates in Request Screenshot from ColdFusion Administrator

When this setting is turned off the file timestamps must be checked every time you create a new instance of a CFC, cfinclude a template, or invoke a custom tag during the life of the request.

When the setting is enabled, and trusted cache is off the file timestamps are only checked on the first invocation of the component or template during the life of the request. This can lead to a signification performance boost in most cases, but the actual amount depends highly on how your code is written.

If you are already using trusted cache, you won't actually see any performance improvement due to this setting. That being said there should be no reason to uncheck this setting if you have trusted cache turned on.

There are some cases where this setting can cause a problem, though they are not very common. If you modify the contents of a template or CFC during the course of the request then the changes will not be picked up on subsequent calls. For example here's a bug report for ModelGlue where the setting causes a problem with event generation.

Thanks to Adobe Engineer Rupesh Kumar for the confirmation, and to Ray Camden for helping to explore the issue. For more on caching settings in ColdFusion 9 see Mike Brunt's blog.



Related Entries

2 people found this page useful, what do you think?

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?