I have a large list of strings (contains usernames, approx 350K records). I need to store it sorted by lexicographical ordering, and ought to be able to retrieve member existence* and member likeness** efficiently. Redis sorted sets look like the data type for the job.
However, I seem to be falling at the first hurdle. Specifically, one of my key requirements is to keep different letter cases together as long as they start with the same letter. E.g. both Bender
and bender
should end up being ordered side by side. However, redis' sorted sets are strict in following lexicographical ordering rules, thus all strings starting with uppercase are by default sorted before all strings starting with lower case (e.g. Z
is ordered before a
, but after A
).
Is there any way I can workaround this and still use redis sorted sets to fulfil my requirements? FYI, I'm using redis version 2.8.4. Thanks in advance.
*member existence: given a username, check whether it already exists in the stored set
**member likeness: given a username, pull up N stored usernames that are most like the given username