本文整理匯總了PHP中Lock::prime_lock方法的典型用法代碼示例。如果您正苦於以下問題:PHP Lock::prime_lock方法的具體用法?PHP Lock::prime_lock怎麽用?PHP Lock::prime_lock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Lock
的用法示例。
在下文中一共展示了Lock::prime_lock方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: class_init
/**
* Register hooks
*/
protected function class_init()
{
// Data storage
add_action('init', array($this, 'register_post_type'));
// Lock for post insertion, to guard against endless event creation when `wp_next_scheduled()` is misused
Lock::prime_lock(self::LOCK);
// Option interception
add_filter('pre_option_cron', array($this, 'get_option'));
add_filter('pre_update_option_cron', array($this, 'update_option'), 10, 2);
}
示例2: prime_event_action_lock
/**
* Prime the event-specific lock
*
* Used to ensure only one instance of a particular event, such as `wp_version_check` runs at one time
*
* @param $event array Event data
*/
private function prime_event_action_lock($event)
{
Lock::prime_lock($this->get_lock_key_for_event_action($event), JOB_LOCK_EXPIRY_IN_MINUTES * \MINUTE_IN_SECONDS);
}