1

Unlike the SortedSet<T> or SortedDictionary<T> from BCL, The Sorted Sets from Redis is much more powerful.

  • It allows access by member, quite like dictionary
  • Sequence is determined on score, a different field from member and allows same value
  • allows to get the min/max value with acceptable time-complexity

I don't want to combine Dictionary + SortedSet to achive my goal.

I am looking at C5 library, not quite sure which class is the best for me.

UPDATE: Finally I found this, matching my requirement very well.

Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97
  • SortedSet is probably as close as you will get. You may try and implement your own thing or use something third party. Take a look at this one: http://www.vcskicks.com/AVL-tree.php. Looks like a good start to me. – danish Dec 12 '14 at 08:14
  • I don't think SortedSet is suitable as it does not allow same `scrore`. – Mr.Wang from Next Door Dec 12 '14 at 08:56
  • What makes you think the `SortedDictionary` type wouldn't work for your purposes? It seems like it would handle all three of the cases you've mentioned pretty reasonably. I'm not sure how `Min` and `Max` are implemented on it, but it seems like you should be able to write something that does it correctly if that isn't natively supported. – Matthew Haugen Dec 12 '14 at 12:23
  • @MatthewHaugen, `SortedDictionary` only allows to sort on a unique `key`; I need it to be sorted on another field(that is `score` in redis's sorted-set) and also allows dunplicate value. – Mr.Wang from Next Door Dec 12 '14 at 15:08
  • ever find anything? – Kyle Gobel Jan 23 '18 at 20:58
  • @KyleGobel, I wrote one by translating the C code from redis source code :) it is a skip-list – Mr.Wang from Next Door Jan 26 '18 at 05:41

0 Answers0