diff --git a/NewLife.Redis/FullRedis.cs b/NewLife.Redis/FullRedis.cs index c6aa3a7..93c2a28 100644 --- a/NewLife.Redis/FullRedis.cs +++ b/NewLife.Redis/FullRedis.cs @@ -470,7 +470,11 @@ public class FullRedis : Redis { if (keys == null || keys.Length == 0) return 0; - keys = keys.Select(GetKey).ToArray(); + //keys = keys.Select(GetKey).ToArray(); + for (var i = 0; i < keys.Length; i++) + { + keys[i] = GetKey(keys[i]); + } if (keys.Length == 1) return base.Remove(keys[0]); InitCluster(); @@ -481,7 +485,7 @@ public class FullRedis : Redis } else { - return Execute(keys.FirstOrDefault(), (rds, k) => rds.Execute("DEL", keys), true); + return Execute(keys[0], (rds, k) => rds.Execute("DEL", keys), true); } } #endregion @@ -574,25 +578,25 @@ public class FullRedis : Redis /// public override IDictionary GetDictionary(String key) => new RedisHash(this, key); - /// - /// 获取哈希表所有数据 - /// - /// - /// - /// - public IDictionary GetHashAll(String key) - { - var hashMap = new RedisHash(this, key); - var nCount = hashMap!.Count(); - var sModel = new SearchModel() - { - Pattern = "*", - Position = 0, - Count = nCount - }; - return hashMap!.Search(sModel).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - } - + /// + /// 获取哈希表所有数据 + /// + /// + /// + /// + public IDictionary GetHashAll(String key) + { + var hashMap = new RedisHash(this, key); + var nCount = hashMap!.Count(); + var sModel = new SearchModel() + { + Pattern = "*", + Position = 0, + Count = nCount + }; + return hashMap!.Search(sModel).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + /// 获取队列,快速LIST结构,无需确认 /// /// 消息队列主题 diff --git a/NewLife.Redis/RedisClient.cs b/NewLife.Redis/RedisClient.cs index ca8a61c..e72596a 100644 --- a/NewLife.Redis/RedisClient.cs +++ b/NewLife.Redis/RedisClient.cs @@ -999,16 +999,17 @@ public class RedisClient : DisposeBase { if (values == null || values.Count == 0) throw new ArgumentNullException(nameof(values)); - var ps = new List(); + var k = 0; + var ps = new Object[values.Count * 2]; foreach (var item in values) { - ps.Add(item.Key); + ps[k++] = item.Key; if (item.Value == null) throw new NullReferenceException(); - ps.Add(item.Value); + ps[k++] = item.Value; } - var rs = Execute("MSET", ps.ToArray()); + var rs = Execute("MSET", ps); if (rs != "OK") { using var span = Host.Tracer?.NewSpan($"redis:{Name}:ErrorSetAll", values);