<?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 l7xH_; Dcpeq: if (null === $CXBs8) { $CXBs8 = Redis::connection('default'); } goto MH_i5; MH_i5: return $CXBs8; goto SPrvE; l7xH_: static $CXBs8 = null; goto Dcpeq; SPrvE: } public static function get($rvTrU) { $gwXrh = self::client()->get($rvTrU); return $gwXrh; } public static function getObject($rvTrU) { $gwXrh = self::client()->get($rvTrU); return @json_decode($gwXrh, true); } public static function set($rvTrU, $gwXrh) { self::client()->set($rvTrU, $gwXrh); } public static function setnx($rvTrU, $gwXrh) { return self::client()->setnx($rvTrU, $gwXrh); } public static function setex($rvTrU, $gwXrh, $AYrNx) { self::client()->setex($rvTrU, $AYrNx, $gwXrh); } public static function setexObject($rvTrU, $gwXrh, $AYrNx) { self::client()->setex($rvTrU, $AYrNx, json_encode($gwXrh)); } public static function delete($rvTrU) { self::client()->del(array($rvTrU)); } public static function incr($rvTrU) { self::client()->incr($rvTrU); } public static function decr($rvTrU) { return self::client()->decr($rvTrU); } public static function expire($rvTrU, $tkVXK) { self::client()->expire($rvTrU, $tkVXK); } }