mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	add 增加 RedisUtils 批量删除 hash key 方法
This commit is contained in:
		@@ -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中的数据
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user