advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Download the code for this article
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

Build a Better ColdFusion Cache Tag

ColdFusion's <cfcache> tag is great, but it caches only whole HTML pages and most templating systems won't play along. Learn how to develop a custom tag that allows you to cache arbitrary sections of ColdFusion-generated pages. 


advertisement
aching is an essential strategy for improving the performance of your applications, and ColdFusion offers much pre-packaged functionality to assist in this area, including a number of application server caching settings in the ColdFusion Administrator. ColdFusion also offers caching options directly through ColdFusion tags. For example, developers can use the <cfquery> tag's cachedAfter and cachedWithin settings to cache the results of database queries and the <cfcache> tag for its direct support of user-interface caching.

The <cfcache> tag is not without its limitations, however. It works very well when you want to cache a whole HTML page, but if you want to cache just part of a page, you are out of luck. The "page" is the smallest unit that <cfcache> can process. Such a restriction might be reasonable for simple applications, but almost any sophisticated application design uses some kind of templating system to assemble complex interfaces from a variety of individual ColdFusion scripts. As such, most modern application designs don't allow whole pages to be cached since to do so requires a single script to serve as the root point for the whole application.


It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement