#
Junjie
2025-11-18 42fd6bd4095414f7a78a2bb5d2c692c04119da2c
src/main/java/com/zy/common/utils/RedisUtil.java
@@ -100,6 +100,26 @@
        return keys;
    }
    public Set<String> scanKeys(String key, int limit) {
        return (Set<String>) redisTemplate.execute((org.springframework.data.redis.core.RedisCallback<Set<String>>) connection -> {
            org.springframework.data.redis.core.ScanOptions options = org.springframework.data.redis.core.ScanOptions.scanOptions().match(key + "*").count(limit).build();
            org.springframework.data.redis.core.Cursor<byte[]> cursor = connection.scan(options);
            java.util.LinkedHashSet<String> result = new java.util.LinkedHashSet<>();
            while (cursor.hasNext()) {
                result.add(new String(cursor.next()));
                if (result.size() >= limit) {
                    break;
                }
            }
            try { cursor.close(); } catch (Exception e) {}
            return result;
        });
    }
    public java.util.List<Object> multiGet(java.util.Collection<String> keys) {
        return redisTemplate.opsForValue().multiGet(keys);
    }
    /**
     * 普通缓存获取
     *