| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Service Provider for atomic locking. |
| 4 |
* |
| 5 |
* @package SolidWP\Performance |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace SolidWP\Performance\Lock; |
| 11 |
|
| 12 |
use SolidWP\Performance\Contracts\Service_Provider; |
| 13 |
use SolidWP\Performance\Lock\Contracts\Blockable_Lock; |
| 14 |
use SolidWP\Performance\Lock\Drivers\Database_Driver; |
| 15 |
use SolidWP\Performance\Lock\Tables\Cache_Lock; |
| 16 |
|
| 17 |
/** |
| 18 |
* The Service Provider for atomic locking. |
| 19 |
* |
| 20 |
* @package SolidWP\Performance |
| 21 |
*/ |
| 22 |
final class Provider extends Service_Provider { |
| 23 |
|
| 24 |
/** |
| 25 |
* @inheritDoc |
| 26 |
*/ |
| 27 |
public function register(): void { |
| 28 |
$this->container->when( Database_Driver::class ) |
| 29 |
->needs( '$table' ) |
| 30 |
->give( fn(): string => Cache_Lock::table_name( false ) ); |
| 31 |
|
| 32 |
// Set up the Lock Driver. |
| 33 |
$this->container->bind( Contracts\Lock::class, Database_Driver::class ); |
| 34 |
// Set up the Lock Decorator. |
| 35 |
$this->container->bind( Blockable_Lock::class, Lock::class ); |
| 36 |
} |
| 37 |
} |
| 38 |
|