Archive for the ColdFusion Category

Distributed Cache with ColdFusion 9.0.1

Easily modify a few configuration files to enable distributed caching using Terracotta and Ehcache for use with ColdFusion’s own caching mechanisms.

If you remember back to my previous post, Intro to Ehcache Server and RESTful Web Services, I went into detail regarding how to set up an out-of-process caching server. If you’re lucky enough to be using ColdFusion 9 and have upgraded to the latest 9.0.1 patch, you may have noticed that one of the updates was to update Ehcache 1.6 to version 2.0. This update enables you to tie your ColdFusion instance in with a Terracotta distributed caching server.

(more…)

ColdFusion 9.0.1 Fixes onRequestEnd Bug

Just a friendly heads-up for those of you out there that had exploited the fact that previous versions of ColdFusion wouldn’t execute the onRequestEnd handler following a page with a cfabort or cflocation tag. The ColdFusion 9.0.1 release has fixed this… so if you’re doing anything in the onRequestEnd function and expect it not to execute, beware!

ColdFusion 9.0.1 Issues Fixed

Intro to Ehcache Server and RESTful Web Services

An out-of-process caching mechanism can seriously help reduce load on your servers and databases. Ehcache provides a very simple, yet powerful, way to cache data and is a system that should be seriously considered when making a caching decision.

When you think of caching there are basically two types: in-process, and out-of-process (or external caching). In-process caching all happens on the host machine and often within the same JVM container (if you’re using ColdFusion specifically). That is, all caching will always reside locally, making caching operations extremely fast. The obvious downside to this method of caching is that the cache consumes the same resources that would have otherwise be spent on your application server.

In order to allow you to scale out (by adding more servers to a cluster, for example) rather than scaling up (by adding additional ram) you need to provide an out-of-process caching mechanism. Again, the obvious downside to an out-of-process setup is the fact that you must serialize and transmit data to an external JVM, which requires much more overhead and transmission time.

(more…)

Writing an Effective Gateway Object

The gateway object is a great way to separate your database calls into a container that could be easily swapped out in the event that you change to a different database setup and to make things a little more distinct and easier to understand when coding.

Assuming you follow the philosophy of the MVC frameworks out there, you’ve likely come across Beans, Services, DAOs (data access objects), and Gateways. Without getting too much into detail about what each of these types of components do, which I’ll get into in a future blog post, your gateway layer is meant to interact with your database where you need to do more than just create, read, update, or delete objects (which is what a DAO is for).

(more…)

Making Bad Code Good

Following best practices is an easy way to keep maintenance costs down.

After listening to Dan Wilson’s session on Making Bad Code Good at cf.Objective() 2010, it really got me to thinking of some best practices that I wish everyone would follow in order to keep that maintenance period (which consumes a majority of a developer’s time and effort) as short as possible.

(more…)