<?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 wagyg; J3Kfv: self::$instance = $YP_1D; goto JYm6M; xD3dD: $YP_1D = new MutexFabric('mysql', $MWS35); goto J3Kfv; wagyg: $MWS35 = new MySqlLock(config('env.DB_USERNAME'), config('env.DB_PASSWORD'), config('env.DB_HOST')); goto xD3dD; JYm6M: } return self::$instance; } public static function acquire($f0dxO, $Qm3dU = null) { if (self::instance()->get($f0dxO)->acquireLock($Qm3dU)) { return true; } return false; } public static function release($f0dxO) { self::instance()->get($f0dxO)->releaseLock(); } }