Using Exclusive Locks

As Table 19.5 shows, there are two types of locks: Exclusive and ReadOnly. Let’s start off simple, and talk about <cflock> tags of type="Exclusive". If you want, you can solve your race condition problems using only Exclusive locks.

Exclusive locks work like this. When your template gets to an opening <cflock> tag in your code, it requests the corresponding lock from the server. There is only one available lock for each scope (Application, Session, Request, or Server), which is why it’s called “exclusive.” Once this Exclusive lock has been bestowed upon your template, it stays there until the closing </cflock> tag in your code, at which point the lock is released and returned to the server. While your template has the lock ...

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.