Redis finding hashes by field values

There are no indexes in redis, and it doesn't implement SQL. It's a key-value store. You provide a key, it gets you a value.

That said, you can implement this by maintaining secondary indexes yourself. For example:

create a record and an index entry

HMSET myhash field1 Hello field2 World
SADD field2_world myhash

update a record, delete old index entry, create new one

SREM field2_world myhash
HMSET myhash field2 Mundo
SADD field2_mundo myhash

find all records which have "World" in field2

SMEMBERS field2_world

I hope you get the idea.

Tags:

Nosql

Redis