#
Junjie
昨天 9af70943c966b0c74dcd735217ff18c9d7564221
src/main/java/com/zy/common/utils/RedisUtil.java
@@ -1,6 +1,7 @@
package com.zy.common.utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
@@ -134,6 +135,7 @@
    public boolean set(String key, Object value) {
        try {
            redisTemplate.opsForValue().set(key, value);
            redisTemplate.execute((RedisCallback<Void>) connection -> null);
            long start = System.currentTimeMillis();
            while (System.currentTimeMillis() - start < 10000) {//有效期10s
                Object o = redisTemplate.opsForValue().get(key);
@@ -167,6 +169,7 @@
            } else {
                set(key, value);
            }
            redisTemplate.execute((RedisCallback<Void>) connection -> null);
            return true;
        } catch (Exception e) {
            e.printStackTrace();