Name

CFLOCK

Synopsis

<CFLOCK> 
CFML and HTML to be locked 
</CFLOCK>

Provides single-threaded access to code within the <CFLOCK>/</CFLOCK> tags. CFLOCK should be used when reading and writing persistent variables (application, session, and server variables) within your ColdFusion applications, to eliminate the potential for data corruption caused by colliding read/writes. CFLOCK can also lock access to non thread-safe CFX tags and to file-manipulation operations that can result in multiple threads attempting to access an already open file.

As of ColdFusion 4.5, additional locking options are available via the ColdFusion Administrator under the Server section. These options allow you to determine how ColdFusion treats locking for all applications across the server. Performance can be significantly affected depending on the options you choose. The following choices are available:

Single Threaded Sessions (Session Scope)

ColdFusion single-threads access to each session by session ID for the duration of a request. While this eliminates all potential variable corruption and conflict within a session, it can have a dramatic effect on performance.

No Automatic Checking or Locking (Session, Application, and Server Scope)

ColdFusion performs no automatic checking or locking of persistent variables. All variables must be locked explicitly using the CFLOCK tag. No exceptions are thrown when nonlocked variables are encountered. This method is how ColdFusion handled locking prior to Version 4.5. This ...

Get Programming ColdFusion 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.