<?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 N5mrD; N5mrD: $LXtOP = new MySqlLock(config('env.DB_USERNAME'), config('env.DB_PASSWORD'), config('env.DB_HOST')); goto dS0G9; ycvcq: self::$instance = $HyetP; goto Vf5aZ; dS0G9: $HyetP = new MutexFabric('mysql', $LXtOP); goto ycvcq; Vf5aZ: } return self::$instance; } public static function acquire($L1g9F, $CG1sb = null) { if (self::instance()->get($L1g9F)->acquireLock($CG1sb)) { return true; } return false; } public static function release($L1g9F) { self::instance()->get($L1g9F)->releaseLock(); } }