Merge branch 'feature/RDMP-5834' into 'master'

feta(RDMP-5834)  keys命令异常抛出

See merge request universal/infrastructure/backend/workflow-engine!23
This commit is contained in:
谭杰 2025-10-29 12:19:26 +00:00
commit 701a2009ab

View File

@ -455,31 +455,39 @@ public class RedisUtils {
/** /**
* 获得缓存的基本对象列表 * 获得缓存的基本对象列表
* 禁止使用会导致Redis阻塞
* *
* @param pattern 字符串前缀 * @param pattern 字符串前缀
* @return 对象列表 * @return 对象列表
*/ */
@Deprecated
public static Collection<String> keys(final String pattern) { public static Collection<String> keys(final String pattern) {
Stream<String> stream = CLIENT.getKeys().getKeysStreamByPattern(pattern); // Stream<String> stream = CLIENT.getKeys().getKeysStreamByPattern(pattern);
return stream.collect(Collectors.toList()); // return stream.collect(Collectors.toList());
throw new UnsupportedOperationException("禁止使用keys命令,请使用scan");
} }
/** /**
* 删除缓存的基本对象列表 * 删除缓存的基本对象列表
* *
* @param pattern 字符串前缀 * @param pattern 字符串前缀
* 禁止使用会导致Redis阻塞
*/ */
@Deprecated
public static void deleteKeys(final String pattern) { public static void deleteKeys(final String pattern) {
CLIENT.getKeys().deleteByPattern(pattern); // CLIENT.getKeys().deleteByPattern(pattern);
throw new UnsupportedOperationException("禁止使用keys命令,请使用scan");
} }
/** /**
* 检查redis中是否存在key * 检查redis中是否存在key
* * 禁止使用会导致Redis阻塞
* @param key * @param key
*/ */
@Deprecated
public static Boolean hasKey(String key) { public static Boolean hasKey(String key) {
RKeys rKeys = CLIENT.getKeys(); // RKeys rKeys = CLIENT.getKeys();
return rKeys.countExists(key) > 0; // return rKeys.countExists(key) > 0;
throw new UnsupportedOperationException("禁止使用keys命令,请使用scan");
} }
} }