package com.starcharge.base.controller; import com.starcharge.base.redis.RedisClient; import org.apache.commons.lang.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** * @author kevin * @create 2020/9/2 22:41 */ @RestController public class RedisTestController { @Resource private RedisClient redisClient; @RequestMapping(value = "/testRedis") public Object testRedis(String key, String value){ if(StringUtils.isNotBlank(key)){ redisClient.put(key,value, 60); return redisClient.get(key); } return null; } }