opt
This commit is contained in:
parent
19eec52e52
commit
4f439361b7
@ -5,6 +5,7 @@ import com.knowledge.base.infrastructure.cache.iface.FileCacheService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.data.redis.core.Cursor;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -84,7 +85,7 @@ public class RedisFileCacheServiceImpl implements FileCacheService {
|
||||
Set<String> keySet = new HashSet<>();
|
||||
// 采用 scan,分批遍历,安全高效
|
||||
redisTemplate.execute((connection) -> {
|
||||
try (var cursor = connection.scan(org.springframework.data.redis.core.ScanOptions.scanOptions()
|
||||
try (Cursor<byte[]> cursor = connection.scan(org.springframework.data.redis.core.ScanOptions.scanOptions()
|
||||
.match(pattern)
|
||||
.count(1000)
|
||||
.build())) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user