database = $database; } public function acquire(int $orderId): bool { return (int) $this->database->fetchValue('SELECT GET_LOCK(' . self::NAME . ', ?)', [$orderId, self::TIMEOUT]) === 1; } public function release(int $orderId): void { $this->database->fetchValue('SELECT RELEASE_LOCK(' . self::NAME . ')', [$orderId]); } }