liubiao4123 / servicestack

Automatically exported from code.google.com/p/servicestack
0 stars 0 forks source link

ServiceStack.Redis GetValues should return null for each key not found in Multi Get #50

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

List<string> keystoget = new List<string>();
keystoget.Add("key1");
keystoget.Add("key2");
keystoget.Add("NONEXISTANT key3");
keystoget.Add("key4");
getvaluesresult = redisPublisher2.GetValues(keystoget);

getvaluesresult.Count should return 4 strings, now it only returns 3.

Current result:
valueforkey1
valueforkey2
valueforkey4

Correct result:
valueforkey1
valueforkey2
null
valueforkey4

Since position is lost, result of key4 is now at position 3. It is not possible 
to know which key was missing.

Another solution would be to return
Dictionary<string,string>, that would have key-value pair.

1.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by logar.da...@gmail.com on 21 Nov 2010 at 3:43

GoogleCodeExporter commented 8 years ago
Hi, yeah I agree. 
Although I don't want to change the current behaviour as it is sometimes the 
desired result.

So following on with your alternate suggestion I've added a couple of new 
methods to IRedisClient/RedisClient:

  Dictionary<string, string> GetValuesMap(List<string> keys);
  Dictionary<string, T> GetValuesMap<T>(List<string> keys);

I'm currently in the process of moving over to GitHub at:
https://github.com/mythz/ServiceStack

So these changes are only available in a binary release (attached) until I have 
the new github source repo sorted out.

- Demis

Original comment by demis.be...@gmail.com on 21 Nov 2010 at 4:23

Attachments: