I have a requirement of passing a List of keys and I need to get the list of values for that keys. Is it possible to retrieve bulk of key values?
cache.Set("A", Object1);
cache.Set("B", Object2);
List
List
sKeys.Add("A");
sKeys.Add("B");
(List
can you help how to retrieve multiple values as list if we pass multiple Keys as list.
And what is "cache" in this example? The IDatabase
API certainly has a multi-key API here:
RedisValue[] StringGet(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
and a matching Async
version; however, without knowledge of your "cache" type, I can't comment - because that doesn't look like SE.Redis' API
IDatabase cache = connection.GetDatabase();
I need to retrieve multiple list of Objects stored in Redis by sending a list of String keys.
So:
var keys = new RedisKey[] { "A", "B" };
var values = cache.StringGet(keys);
var a = (string)values[0];
var b = (byte[])values[1];
or similar
Most helpful comment
So:
or similar