PHP Class Automattic\WP\Cron_Control\Lock

Show file Open project: Automattic/vip-mu-plugins-public Class Usage Examples

Public Methods

Method Description
check_lock ( $lock, $limit = null, $timeout = null ) : boolean Set a lock and limit how many concurrent jobs are permitted
free_lock ( $lock, $expires ) When event completes, allow another
get_lock_timestamp ( $lock ) Retrieve a lock's timestamp
get_lock_value ( $lock ) Retrieve a lock from cache
prime_lock ( $lock, $expires ) Ensure lock entries are initially set
reset_lock ( $lock, $expires ) Clear a lock's current values, in order to free it

Private Methods

Method Description
get_key ( $lock, $type = 'lock' ) Build cache key

Method Details

check_lock() public static method

Set a lock and limit how many concurrent jobs are permitted
public static check_lock ( $lock, $limit = null, $timeout = null ) : boolean
$lock string Lock name
$limit int Concurrency limit
$timeout int Timeout in seconds
return boolean

free_lock() public static method

When event completes, allow another
public static free_lock ( $lock, $expires )

get_lock_timestamp() public static method

Retrieve a lock's timestamp
public static get_lock_timestamp ( $lock )

get_lock_value() public static method

Retrieve a lock from cache
public static get_lock_value ( $lock )

prime_lock() public static method

Ensure lock entries are initially set
public static prime_lock ( $lock, $expires )

reset_lock() public static method

Clear a lock's current values, in order to free it
public static reset_lock ( $lock, $expires )