Redis based <cflock> that can be used across servers, i.e. in a clustered environment
This tag must have a body.
This tag is also supported within <cfscript>
Requires Extension: Redis driver
<cfdistributedlock
name=string
cache=string
timeout=numeric
throwontimeout=boolean
logontimeout=boolean
amount=numeric
expires=numeric
bypass=boolean
><!--- body ---></cfdistributedlock>
Attribute |
Description |
name
string, required
|
Specifies the name of the lock.
Only {amount} (see attribute amount) request(s) can execute inside this tag with a given name.
Therefore, providing the name attribute allows for synchronizing access to resources from different parts of an application.
Lock names are global to a server.
They are shared between applications and user sessions, but not across clustered servers.
|
cache
string, required
|
name of the redis cache used to lock.
|
timeout
numeric, optional
|
Specifies the maximum amount of time in seconds, to wait to obtain a lock.
If a lock can be obtained within the specified period, execution continues inside the body of the tag.
Otherwise, the behavior depends on the value of the throwOnTimeout attribute.
The value must be at least 0.01.
|
throwontimeout
boolean, optional
|
Yes or No. Specifies how timeout conditions are handled.
If the value is Yes, an exception is generated to provide notification of the timeout.
If the value is No, execution continues after the tag. Default is No.
|
logontimeout
boolean, optional
|
In case we reach a timeout, and the value is set to yes, we log this to the application.log. Default is Yes.
|
amount
numeric, optional
|
Defines the amount of parallel threads allowed within the lock, default is 1.
|
expires
numeric, optional
|
The time in seconds a lock remains in case it not get released, by default this is 10 minutes.
|
bypass
boolean, optional
|
If set to true the lock is not done at all.
|
Examples
There are currently no examples for this tag.
19,728ms WARN No examples for tag distributedlock
See also