本文整理汇总了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);
}