add 增加 RedisUtils 批量删除 hash key 方法

feature/model
疯狂的狮子li 1 year ago
parent f78df97bcc
commit d5c33b5604

@ -1,8 +1,8 @@
package org.dromara.common.redis.utils; package org.dromara.common.redis.utils;
import org.dromara.common.core.utils.SpringUtils;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.dromara.common.core.utils.SpringUtils;
import org.redisson.api.*; import org.redisson.api.*;
import java.time.Duration; import java.time.Duration;
@ -374,6 +374,21 @@ public class RedisUtils {
return rMap.remove(hKey); return rMap.remove(hKey);
} }
/**
* Hash
*
* @param key Redis
* @param hKeys Hash
*/
public static <T> void delMultiCacheMapValue(final String key, final Set<String> hKeys) {
RBatch batch = CLIENT.createBatch();
RMapAsync<String, T> rMap = batch.getMap(key);
for (String hKey : hKeys) {
rMap.removeAsync(hKey);
}
batch.execute();
}
/** /**
* Hash * Hash
* *

Loading…
Cancel
Save