ColdFusion is better than…

  • Post author:
  • Post category:Uncategorized

I’m continuing my look at ways that ColdFusion excels above it’s competition. This time I wanted to compare caching in ColdFusion to PHP. Caching is useful for dynamic pages that contain content that doesn’t change very often. For example, say you have a contact info page that pulls data from your DB. If your company doesn’t change very often, the contact info on that page won’t change either. So you could set your contact page to pull from cache and only refresh once a day. This will save your server from needing to process that page on every request, and the user will get the page faster. From my research, it appears that caching capabilities are pretty similar in both languages. However, it is a lot easier to do in ColdFusion. Here is some PHP code to do caching (obtained from here):\n"; exit; } ob_start(); // start the output buffer?>.. Your usual PHP script and HTML here ...Here is CF code that does the same thing:You will notice that in PHP you have to manually cache the page to disk, manually check for file changes, and manually check the expiration. However, ColdFusion automatically flushes cached pages when you change the code, and it will automatically flush pages after the expiration timespan passes. And all you have to do is put the cfcache tag in your page.The biggest difference I’ve noticed when I compare CF to PHP is the amount of coding. PHP is very powerful, but when compared to ColdFusion, you generally have to do more coding to get the same things done.