$lock_duration
$lock_duration : int
Duration of lock.
Provide a way to set simple transient locks to block behaviour for up-to a given duration.
Class ActionScheduler_OptionLock
$lock_duration : int
Duration of lock.
$locker : \ActionScheduler_Lock
Instance.
set(string $lock_type) : bool
Set a lock using options for a given amount of time (60 seconds by default).
Using an autoloaded option avoids running database queries or other resource intensive tasks on frequently triggered hooks, like 'init' or 'shutdown'.
For example, ActionScheduler_QueueRunner->maybe_dispatch_async_request() uses a lock to avoid calling ActionScheduler_QueueRunner->has_maximum_concurrent_batches() every time the 'shutdown', hook is triggered, because that method calls ActionScheduler_QueueRunner->store->get_claim_count() to find the current number of claims in the database.
string | $lock_type | A string to identify different lock types. |
get_expiration_from(string $lock_value) : bool|int
Given the lock string, derives the lock expiration timestamp (or false if it cannot be determined).
string | $lock_value | String containing a timestamp, or pipe-separated combination of unique value and timestamp. |
new_lock_value(string $lock_type) : string
Supplies a lock value consisting of a unique value and the current timestamp, which are separated by a pipe character.
Example: (string) "649de012e6b262.09774912|1688068114"
string | $lock_type | A string to identify different lock types. |