How can I get all of the sets in redis?

I know the KEYS command, but that only returns the keys (I’m guessing
all of the keys with type String), and apparently sets aren’t
considered keys.

KEYS command return results no matter what data type are your keys, since it searches key names. At the lowest level of abstraction each data type in redis is key/value based where value can be represented as one of several (advanced) data structures (string, hash, list, set, sorted set). You can see that KEYS command also work for sets in it’s examples.

Is there a command for getting all of the sets in the database? What
about other data types (hash, list, sorted set)?

As far as I know there is no dedicated command for this functionality and KEYS command is applied on entire data set of your database. However there is a TYPE command which can determine data type of specified key.

Leave a Comment