Clearing individual files/folders from ColdFusion template's cache

A little bit ago I sat in the session “End to End Performance Tuning”, which was a great session. One of the tips mentioned was the use of trusted cache on production systems. One of the problems with this though is that you need to clear the template cache for each and every little change. What folks tend to forget is that the Admin API has support to clear individual files. I blogged about this last year (at CFUN I think) and wrote up a quick little script to show an example of it. This came up again during the session so I thought I’d work a bit on the script and make it a bit more presentable in the ColdFusion Admin.

Take the script attached to this template and put it in your ColdFusion Administrator folder. Put it in a subfolder named anything you want, I used cacheclearer. Then edit custommenu.xml to add a link:

<menuitem href="cacheclearer/" target="content">Cache Clearer</menuitem>

Then hit up your Admin and you can run the utility. You can enter a CFM/CFC to clear or a folder and all CFM/CFCs under it will be clearer.

<p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless 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 https://www.raymondcamden.com

Comments