<cflock>
Provides two types of locks to ensure the integrity of shared data: Exclusive lock and Read-only lock.
An exclusive lock single-threads access to the CFML constructs in its body. Single-threaded access implies that the body of the tag can be executed by at most one request at a time. A request executing inside a cflock tag has an "exclusive lock" on the tag. No other requests can start executing inside the tag while a request has an exclusive lock. Lucee issues exclusive locks on a first-come, first-served basis.
A read-only lock allows multiple requests to access the CFML constructs inside its body concurrently. Therefore, read-only locks should be used only when the shared data is read only and not modified. If another request already has an exclusive lock on the shared data, the request waits for the exclusive lock to be released.
This tag must have a body.
This tag is also supported within <cfscript>
<cflock
timeout=object
scope=string
name=string
throwOnTimeout=boolean
type=string
result=string
><!--- body ---></cflock>
Examples
https://www.youtube.com/watch?time_continue=4&v=x_TUx6EJ9nY
Related System Properties / Environment Variables
- LUCEE_TAG_POPULATE_LOCALSCOPE - Controls whether tags like cflock and cfquery populate their default result variables to local scope when inside a function. When `true`, variables go to local scope. When `false`, restores pre-LDEV-5416 behavior where variables go to variables scope
Type: boolean, Default: true, Introduced: 7.0.1.13
See also
- Core CFML Language
- Scopes
- Lucee Server related Tags, Functions and Guides
- <cfdistributedlock>
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)