filter()->implode(':'); } public static function getLock($lockKey, $expireSeconds = 1, $throwException = false) { $lock = Redis::setnx($lockKey, 1); if (!$lock) { if ($throwException) { throw new ServiceException('操作频繁'); } return false; } Redis::expire($lockKey, $expireSeconds); return true; } public static function deleteLock($lockKey) { return Redis::del($lockKey); } }