2881099 / csredis

.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
MIT License
2k stars 414 forks source link

redishelper add HMSet(string key, Dictionary<string,object> keyValues) method #316

Open RoinBi opened 4 years ago

RoinBi commented 4 years ago

I need this method

2881099 commented 4 years ago

You can convert it into a kV array.

RedisHelper.HMSet(key, kvArray);

scpdqpi commented 2 years ago

I need this method too

scpdqpi commented 2 years ago

You can convert it into a kV array.

RedisHelper.HMSet(key, kvArray);

for example?

2881099 commented 2 years ago
RedisHelper.HMSet(key, "field1", "value1", "field2", "value2");

OR

Dictionary<string,object> keyValues = ...;
object[] objects = keyValues.Select(kv => new object[] { kv.Key, kv.Value }).SelectMany(a => a).ToArray();
RedisHelper.HMSet(key, objects);