What are the key data structures supported by Redis?

The key data structures supported by Redis are:

1. Strings: Strings are the most basic data structure in Redis and are used to store text-based data. For example, a key-value pair of “name” and “John” would be stored as a string in Redis.

2. Hashes: Hashes are used to store a collection of key-value pairs. For example, a key-value pair of “name” and “John” could be stored as a hash with the key “person” and value of “name: John”.

3. Lists: Lists are used to store a collection of ordered values. For example, a list of names could be stored as a list with the values “John”, “Mary”, and “Bob”.

4. Sets: Sets are used to store a collection of unordered values. For example, a set of numbers could be stored as a set with the values “1”, “2”, and “3”.

5. Sorted Sets: Sorted sets are used to store a collection of ordered values. For example, a set of numbers could be stored as a sorted set with the values “1”, “2”, and “3”, where they are sorted by their numerical value.

What are the different data types supported by Redis?

The following data types are supported by Redis:

1. Strings: Strings are the most basic data type in Redis and are used to store text or numerical values. For example, a string can store a name, an address, or a phone number.

2. Lists: Lists are collections of strings, sorted by insertion order. For example, a list could contain a list of names, emails, or phone numbers.

3. Hashes: Hashes are collections of key-value pairs, where the key is a string and the value can be a string, number, or even another data type. For example, a hash could contain a person’s name, phone number, and email address.

4. Sets: Sets are collections of unique strings, sorted by insertion order. For example, a set could contain a list of unique usernames or email addresses.

5. Sorted Sets: Sorted sets are collections of unique strings, where each string is associated with a score. The strings are sorted by their scores, in ascending or descending order. For example, a sorted set could contain a list of usernames and their associated scores in a game.

6. Bitmaps: Bitmaps are collections of bits, where each bit represents a single value. For example, a bitmap could be used to store a list of binary flags, such as whether or not a user has completed a certain task.