Twitter: raymondcamden


Address: Lafayette, LA, USA

ColdFusion Trusted Cache and Deleted Files

06-09-2014 2,336 views ColdFusion 2 Comments

Just a small warning to folks using trusted cache on their production ColdFusion sites. If you have it enabled, hit a particular file, and then delete it, ColdFusion will still serve the file up. That isn't too surprising I suppose, but you may not be aware of it. While I bet most of you know that, I bet a lot of you may make the mistake I made.

Instead of clearing the entire Trusted Cache, I always use the newer folder option, see here:

This feature (which you can get via a ColdFusion Admin extension for older servers) lets you clear just one folder from the trusted cache. It is a kinder, gentler version of the "Nuke Everything From Orbit" button that clears the entire cache.

Except when I used this - it didn't work. It took me a few seconds (ok, minutes) to figure out why. The code behind this button gets all the files from the folder and clears them from trusted cache. Since the file I wanted to clear was deleted, it didn't work. The API for clearing the cache only supports files, not folders. (It should support both I'd say.) Obvious, right?

2 Comments

  • Jack #
    Commented on 06-10-2014 at 8:55 AM
    Is there a difference between "template cache" and "trusted cache"?
  • Commented on 06-10-2014 at 9:07 AM
    I assume you mean, "Cache template in request" ? If so, that refers to how often CF will check a template during one request. Imagine a CFM does a cfinclude of foo.cfm a few times in one file. (Seems silly, but there are reasons why you may do that.) If this setting is on, CF will only load/parse the file once during the request. To be clear, it still executes the code right, but it doesn't re-check/parse the CFM after the first time.

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty