<?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 qJNcf; auCtg: $gDysi = new MutexFabric('mysql', $rljo1); goto LXTqT; qJNcf: $rljo1 = new MySqlLock(config('env.DB_USERNAME'), config('env.DB_PASSWORD'), config('env.DB_HOST')); goto auCtg; LXTqT: self::$instance = $gDysi; goto CV3oN; CV3oN: } return self::$instance; } public static function acquire($c6VKG, $t33Sv = null) { if (self::instance()->get($c6VKG)->acquireLock($t33Sv)) { return true; } return false; } public static function release($c6VKG) { self::instance()->get($c6VKG)->releaseLock(); } }