Administrator
2025-12-17 6a51883c6d96702df7e1df023b3ad3e0fd575b16
src/main/java/com/xcong/excoin/utils/RedisUtils.java
@@ -90,6 +90,35 @@
    public Object get(String key) {
        return key == null ? null : redisTemplate.opsForValue().get(key);
    }
    public Object getWithDelay(String key) {
        // 在读取前添加短暂延迟
        try {
            Thread.sleep(50); // 等待50ms让Redis同步完成
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        return key == null ? null : redisTemplate.opsForValue().get(key);
    }
    /**
     * 普通缓存获取
     * @param key 键
     * @return 值
     */
    public String getStringWithDelay(String key) {
        // 在读取前添加短暂延迟
        try {
            Thread.sleep(50); // 等待50ms让Redis同步完成
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
        Object obj = key == null ? null : redisTemplate.opsForValue().get(key);
        if(obj!=null){
            return obj.toString();
        }
        return null;
    }
    /**