<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Facades\Redis; class RedisUtil { public static function isEnable() { return !!config('env.REDIS_HOST'); } public static function client() { goto rvsN1; m7yO0: return $LxLaW; goto Ws87O; S5exO: if (null === $LxLaW) { $LxLaW = Redis::connection('default'); } goto m7yO0; rvsN1: static $LxLaW = null; goto S5exO; Ws87O: } public static function get($oMJcb) { $cBDsM = self::client()->get($oMJcb); return $cBDsM; } public static function getObject($oMJcb) { $cBDsM = self::client()->get($oMJcb); return @json_decode($cBDsM, true); } public static function set($oMJcb, $cBDsM) { self::client()->set($oMJcb, $cBDsM); } public static function setnx($oMJcb, $cBDsM) { return self::client()->setnx($oMJcb, $cBDsM); } public static function setex($oMJcb, $cBDsM, $nR8Zz) { self::client()->setex($oMJcb, $nR8Zz, $cBDsM); } public static function setexObject($oMJcb, $cBDsM, $nR8Zz) { self::client()->setex($oMJcb, $nR8Zz, SerializeUtil::jsonEncode($cBDsM)); } public static function delete($oMJcb) { self::client()->del(array($oMJcb)); } public static function incr($oMJcb) { self::client()->incr($oMJcb); } public static function decr($oMJcb) { return self::client()->decr($oMJcb); } public static function expire($oMJcb, $oWvwl) { self::client()->expire($oMJcb, $oWvwl); } }