Discover the test, if the key already exists, call Redis.Add (key, value) you can not add or modify the contents of this key value;
In this case, we add a key and value when the judge had once ContainsKey (key),
In this case, it caused two search process Hash Table of Reids.
The question is:
Why Redis in the end there is no offer similar functions TryGetValue Dictionary Search + take an address (key, out value), thus saving at least half the time.
Problem has been solved:
Discover the test Redis method Set (key, value), equivalent to the dictionary Dictionary.TryGetValue (key, out value).
The full realization of a search, both new data and modify data at the same time (if the key does not exist before).
The modified test, the interface ICacheHelper.SetCacheData () properties are as follows: (abandoned ContainsKey method determination KEY)
Discover the test, if the key already exists, call Redis.Add (key, value) you can not add or modify the contents of this key value;
In this case, we add a key and value when the judge had once ContainsKey (key),
In this case, it caused two search process Hash Table of Reids.
The question is:
Why Redis in the end there is no offer similar functions TryGetValue Dictionary Search + take an address (key, out value), thus saving at least half the time.
Problem has been solved:
Discover the test Redis method Set (key, value), equivalent to the dictionary Dictionary.TryGetValue (key, out value).
The full realization of a search, both new data and modify data at the same time (if the key does not exist before).
The modified test, the interface ICacheHelper.SetCacheData () properties are as follows: (abandoned ContainsKey method determination KEY)