<?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 MF3zF; j8uuu: self::$instance = $CPTQ1; goto F4zZC; MF3zF: $mKlCF = new MySqlLock(config('env.DB_USERNAME'), config('env.DB_PASSWORD'), config('env.DB_HOST')); goto zbOBz; zbOBz: $CPTQ1 = new MutexFabric('mysql', $mKlCF); goto j8uuu; F4zZC: } return self::$instance; } public static function acquire($ZZMEd, $Cq6fQ = null) { if (self::instance()->get($ZZMEd)->acquireLock($Cq6fQ)) { return true; } return false; } public static function release($ZZMEd) { self::instance()->get($ZZMEd)->releaseLock(); } }