ColdFusion Trusted Cache and Deleted Files

This post is more than 2 years old.

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?

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Jack posted on 6/10/2014 at 5:55 PM

Is there a difference between "template cache" and "trusted cache"?

Comment 2 by Raymond Camden posted on 6/10/2014 at 6:07 PM

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.