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
- ColdFusion returning empty response with server-error: true
- Careful applying CF11u16, CF2016u8, CF2018u2
- Sessions don't work in Chrome but do in IE
- csrfVerifyToken does not invalidate the token
- The cf_sql_ is optional in cfqueryparam
- Cookie Expires / Max-Age 1969-12-31T23:59:59.000Z
- Burst Throttling on AWS API Gateway Explained
- How to Resolve Java HTTPS Exceptions