疯狂的狮子li
2022-06-06 b27e55f4de22d27588033ef369048ed2e23f93b5
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java
@@ -12,7 +12,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.TimeUnit;
import java.time.Duration;
/**
 * spring-cache 演示案例
@@ -87,7 +87,7 @@
    @GetMapping("/test6")
    public R<Boolean> test6(String key, String value) {
        RedisUtils.setCacheObject(key, value);
        boolean flag = RedisUtils.expire(key, 10, TimeUnit.SECONDS);
        boolean flag = RedisUtils.expire(key, Duration.ofSeconds(10));
        System.out.println("***********" + flag);
        try {
            Thread.sleep(11 * 1000);