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.
Is there a command for getting all of the sets in the database? What about other data types (hash, list, sorted set)?
http://redis.io/topics/data-types
Redis GET all Keys To list the keys in the Redis data store, use the KEYS command followed by a specific pattern. Redis will search the keys for all the keys matching the specified pattern. In our example, we can use an asterisk (*) to match all the keys in the data store to get all the keys.
By clicking on a Redis key name, all its contents will open in a new editor tab. With a collection type Redis key, clicking on it will reveal the individual elements under the key name. Clicking the individual element will display its contents in a new editor tab.
A Redis server has 16 databases by default. You can check the actual number by running redis-cli config get databases. In interactive mode, the database number is displayed in the prompt within square braces. For example, 127.0. 0.1:6379[13] shows that the 13th database is in use.
The Redis “get set” (GETSET) command allows you to set a key to a specified value and return the old value that was stored at the key. The Redis GETSET command is often used in conjunction with the INCR command to handle counting.
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.
The answer was correct for its time, however this is supported from redis 2.8.0 - Check out SCAN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With