Monday, January 12, 2009

A few things about onMissingMethod()

ColdFusion 8 includes the onMissingMethod event handler, a very simple yet powerful feature that can be used in a variety of ways, from implicit getters and setters to method interceptors and more.

I've stumbled upon 2 things worth mentioning that didn't seem apparent at first.

1. onMissingMethod only works for public method calls. If you try to access a function remotely, such as http://mysite.com/components/foo.cfc?method=bar, and the bar() method doesn't exist, onMissingMethod won't catch it.

2. If you're using memcached to cache your objects, onMissingMethod won't fire at all. This seems to make sense, since ColdFusion appears to fire onMissingMethod at runtime.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.