疯狂的狮子li
2022-05-12 ae960f52200f9111a96c2c257071d096028fca95
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);