How do you search for keys with a value in Ruby? For example get all KEYS where the value is "somevalue".
My keys are
"xyz" => {:status=> "connected", :topic=> "ABC"}
"PQR" => {:status=> "connected", :topic=> "ABC"}
Now I need to find all the KEYS where topic is "ABC"
Regardless the programming language, to do this efficiently you'll need to maintain an "index" key that maps somevalue to the key names. Using a Set or a Sorted Set for this is what you should usually do - i.e. add new key names to it and remove them according to their values - and get that key's contents when you want to "search".
There are some libraries (i.e. gems) that may provide this sort of functionality ready to use - look into the most excellent Ohm in your case.
EDIT
I would store xyz's value as a String or a Hash (depending on whether I need to update/read just parts of it or not). Then I would
SADD topic:ABC xyzand doSMEMBERSorSSCANon it to get the names of all keys with that topic. I'd also try to remember toSREMthe relevant member from topic:ABC when IDELits key...