ActionScheduler_OptionLock::set( string $lock_type )

Set a lock using options for a given amount of time (60 seconds by default).


Description Description

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.


Parameters Parameters

$lock_type

(Required) A string to identify different lock types.


Top ↑

Source Source

File: packages/action-scheduler/classes/ActionScheduler_OptionLock.php


			


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.