Using Named Locks instead of SCOPE

You’ve seen why locks are sometimes needed to avoid race conditions. You’ve seen the simplest way to implement them—with Exclusive locks. You’ve seen how to avoid potential bottlenecks by using a mix of Exclusive and ReadOnly locks. Hopefully, you’ve noticed a pattern emerging: If you’re worried about race conditions, your goal should be to protect your data with <cflock>, but to do so in the least obtrusive way possible. That is, you want your code to be “smart” about when page requests wait for each other.

So far, all of the <cflock> tags in this chapter have been scoped locks. Each has used a scope="Application" attribute to say, “This lock should block or be blocked by all other locks in the application.” ...

Get Adobe ColdFusion 8 Web Application Construction Kit, Volume 1: Getting Started now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.