I'm trying to store multiple member-score values using Redis Booksleeve but the Booksleeve api doesn't seem to support this functionality.
conn.SortedSets.Add overload supports only single pairs of value - scores.
Do i miss something or this is on purpose or something that you forgot to implement?
Currently i'm updating my sorted set in a transaction loop like this:
foreach (ForumMessage message in messages)
{
trans.SortedSets.Add(db, redisKey, message.id.ToString(), message.id);
}
trans.Execute();
Is the above the same as doing a ZADD with multiple member-score values from performance perspective?
It won't be quite as efficient:
But... it'll still be pretty fast.
There are hacky ways around the latter, including:
try
/finally
if you do this!)However, you might want to know that StackExchange.Redis has a multi key/value SortedSetAdd
method that does exactly what you want.