How to retrieve multiple values in list if we pass multiple Keys in a list ?
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<KeyValuePair<string, object>> redisbulkretrieve;
List
(List<KeyValuePair<string, object>>)cache.get(sKeys) --> doesnot work..
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
I used RedisValue[] StringGet(RedisKey[] keys, CommandFlags flags = CommandFlags.None); with bulk record (>1milion) then it not work and show message "this operation would involve too many arguments mget"
Well ... yes, don't do that. Batch your data into multiple calls with some reasonable number of keys per call. "Reasonable" depends on the size of each payload (there's a difference between fetching 1kB values vs 200MiB values), but I'd probably start with 1024 keys per call and see how it behaves.
Well ... yes, don't do that. Batch your data into multiple calls with some reasonable number of keys per call. "Reasonable" depends on the size of each payload (there's a difference between fetching 1kB values vs 200MiB values), but I'd probably start with 1024 keys per call and see how it behaves.
I having issue copy database to server another. Can you solve help me?
Is just coping the RDB file sufficient? If not: crawl the keyspace via GetServer() and .Keys(...), and for each key: use KeyDump[Async] and KeyTimeToLive[Async] on the source and KeyRestore[Async] on the target.
(the advantage of this is that you don't need to know what type of value is behind each key - string, hash, etc)