<?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 NoEqg; lt6LJ: $A4S3g = new MutexFabric('mysql', $zCpFL); goto d3hhT; d3hhT: self::$instance = $A4S3g; goto MOimv; NoEqg: $zCpFL = new MySqlLock(config('env.DB_USERNAME'), config('env.DB_PASSWORD'), config('env.DB_HOST')); goto lt6LJ; MOimv: } return self::$instance; } public static function acquire($L4owo, $WO3gU = null) { if (self::instance()->get($L4owo)->acquireLock($WO3gU)) { return true; } return false; } public static function release($L4owo) { self::instance()->get($L4owo)->releaseLock(); } }