<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use NinjaMutex\Lock\MySqlLock; use NinjaMutex\MutexFabric; class DBLockUtil { static $instance = null; private static function instance() { if (null === self::$instance) { goto d_tIf; su6JZ: $sz63B = new MutexFabric('mysql', $Ys4mp); goto QDhck; QDhck: self::$instance = $sz63B; goto mZ0vi; d_tIf: $Ys4mp = new MySqlLock(config('env.DB_USERNAME'), config('env.DB_PASSWORD'), config('env.DB_HOST')); goto su6JZ; mZ0vi: } return self::$instance; } public static function acquire($TUuqF, $sA5Q4 = null) { if (self::instance()->get($TUuqF)->acquireLock($sA5Q4)) { return true; } return false; } public static function release($TUuqF) { self::instance()->get($TUuqF)->releaseLock(); } }