wpdesk / wp-mutex
Library for locking in Wordpress.
1.1
2018-11-13 12:27 UTC
Requires
- php: >=5.6
Requires (Dev)
- 10up/wp_mock: *
- mockery/mockery: *
- phpunit/phpunit: <7
- squizlabs/php_codesniffer: ^3.0.2
- wimg/php-compatibility: ^8
- wp-coding-standards/wpcs: ^0.14.1
This package is auto-updated.
Last update: 2024-11-14 03:45:39 UTC
README
wpdesk/wp-lock
wp-mutex is a simple library for WordPress plugins to help executing critical code in concurrent situations.
Requirements
PHP 5.5 or later.
Composer
You can install the bindings via Composer. Run the following command:
composer require wpdesk/wp-mutex
To use the bindings, use Composer's autoload:
require_once 'vendor/autoload.php';
Manual installation
If you do not wish to use Composer, you can download the latest release. Then, to use the Notices, include the init.php file.
require_once('/path/to/notice/src/init.php');
Getting Started
Simple usage looks like:
$lock_name = 'my_lock_name';
if ( wpdesk_acquire_lock( $lock_name ) ) {
// do critical stuff
wpdesk_release_lock( $lock_name );
} else {
echo 'Unable to acquire lock!';
}