疯狂的狮子Li
2022-01-25 3706d2e1db45e64a1375b92300901de39e35e464
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
@@ -9,7 +9,6 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -52,8 +51,8 @@
     * 测试lock4j 工具
     */
    @ApiOperation("测试lock4j 工具")
    @GetMapping("/testLock4jLockTemaplate")
    public AjaxResult<String> testLock4jLockTemaplate(String key, String value) {
    @GetMapping("/testLock4jLockTemplate")
    public AjaxResult<String> testLock4jLockTemplate(String key, String value) {
        final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
        if (null == lockInfo) {
            throw new RuntimeException("业务处理中,请稍后再试");
@@ -74,13 +73,4 @@
        return AjaxResult.success("操作成功", value);
    }
    /**
     * 测试spring-cache注解
     */
    @ApiOperation("测试spring-cache注解")
    @Cacheable(value = "test", key = "#key")
    @GetMapping("/testCache")
    public AjaxResult<String> testCache(String key) {
        return AjaxResult.success("操作成功", key);
    }
}