| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Lock contract. |
| 4 |
* |
| 5 |
* @package SolidWP\Performance |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace SolidWP\Performance\Lock\Contracts; |
| 11 |
|
| 12 |
/** |
| 13 |
* The Lock contract. |
| 14 |
* |
| 15 |
* @internal |
| 16 |
* |
| 17 |
* @package SolidWP\Performance |
| 18 |
*/ |
| 19 |
interface Lock { |
| 20 |
|
| 21 |
/** |
| 22 |
* Attempt to acquire a lock. |
| 23 |
* |
| 24 |
* @return bool |
| 25 |
*/ |
| 26 |
public function acquire(): bool; |
| 27 |
|
| 28 |
/** |
| 29 |
* Determine if this lock is already acquired. |
| 30 |
* |
| 31 |
* @return bool |
| 32 |
*/ |
| 33 |
public function is_acquired(): bool; |
| 34 |
|
| 35 |
/** |
| 36 |
* Get the original owner of the lock. |
| 37 |
* |
| 38 |
* @return string |
| 39 |
*/ |
| 40 |
public function owner(): string; |
| 41 |
|
| 42 |
/** |
| 43 |
* Release the lock, if the original owner matches the current one. |
| 44 |
* |
| 45 |
* @return bool |
| 46 |
*/ |
| 47 |
public function release(): bool; |
| 48 |
|
| 49 |
/** |
| 50 |
* Force release the lock, regardless of who owns it. |
| 51 |
* |
| 52 |
* @return bool |
| 53 |
*/ |
| 54 |
public function force_release(): bool; |
| 55 |
} |
| 56 |
|