RedisTestController.java 710 Bytes
Newer Older
苗卫卫 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
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;
    }
}