<?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 tnnTD; vn0W1: if (null === $EG0Hq) { $EG0Hq = Redis::connection('default'); } goto xZeyQ; xZeyQ: return $EG0Hq; goto mDzcb; tnnTD: static $EG0Hq = null; goto vn0W1; mDzcb: } public static function get($m1RYi) { $tzAUI = self::client()->get($m1RYi); return $tzAUI; } public static function getObject($m1RYi) { $tzAUI = self::client()->get($m1RYi); return @json_decode($tzAUI, true); } public static function set($m1RYi, $tzAUI) { self::client()->set($m1RYi, $tzAUI); } public static function setnx($m1RYi, $tzAUI) { return self::client()->setnx($m1RYi, $tzAUI); } public static function setex($m1RYi, $tzAUI, $LoBMc) { self::client()->setex($m1RYi, $LoBMc, $tzAUI); } public static function setexObject($m1RYi, $tzAUI, $LoBMc) { self::client()->setex($m1RYi, $LoBMc, json_encode($tzAUI)); } public static function delete($m1RYi) { self::client()->del(array($m1RYi)); } public static function incr($m1RYi) { self::client()->incr($m1RYi); } public static function decr($m1RYi) { return self::client()->decr($m1RYi); } public static function expire($m1RYi, $CWDaA) { self::client()->expire($m1RYi, $CWDaA); } }