Merge branch 'master' into pre

This commit is contained in:
wangli 2025-10-31 13:59:23 +08:00
commit 86a4f2b810
2 changed files with 24 additions and 6 deletions

View File

@ -35,6 +35,16 @@ public enum FileTypeEnum {
return fromValue(type);
}
public static FileTypeEnum valueOfLikeSuffix(String suffix) {
if (suffix == null) {
return UNKNOWN;
}
return Arrays.stream(FileTypeEnum.values())
.filter(e -> e.getSuffix().contains(suffix))
.findFirst()
.orElse(UNKNOWN);
}
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public static FileTypeEnum fromValue(String value) {
if (value == null) {

View File

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