Cache Template in Request Setting Explained
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.
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.
- ColdFusion 9 Performance Brief from Adobe - February 24, 2010
- OutOfMemoryError - GC overhead limit exceeded - March 25, 2010
- How CFThread Can Help OR Hurt Performance - July 9, 2009
- CFThread - Don't Abuse It - August 7, 2007
- 8 Ways to Save Bandwidth on your RSS Feed - July 12, 2007
- Java Unlimited Strength Crypto Policy for Java 9 or 1.8.0_151
- Java 9 Security Enhancements
- Upcoming CFML Conferences in April 2017
- CFSummit 2016 Slides
- Securing Legacy CFML - dev.Objective() 2016 Slides
- My CFSummit 2015 Slide Decks
- Adding Chrome Custom Search for CFDocs
- Disable Flash Remoting on ColdFusion Servers