WordPress at Your Fingertips
function is not described

ActionScheduler_OptionLock::set() public WC 1.0

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.

{} It's a method of the class: ActionScheduler_OptionLock{}

No Hooks.


null. Nothing.


$ActionScheduler_OptionLock = new ActionScheduler_OptionLock();
$ActionScheduler_OptionLock->set( $lock_type );
$lock_type(string) (required)
A string to identify different lock types.

Code of ActionScheduler_OptionLock::set() WC 6.1.1

public function set( $lock_type ) {
	return update_option( $this->get_key( $lock_type ), time() + $this->get_duration( $lock_type ) );