| | |
| | | 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; |
| | |
| | | * 测试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("业务处理中,请稍后再试"); |
| | |
| | | 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); |
| | | } |
| | | } |