Redis supports 5 types of data types.
Strings
Redis string is a sequence of bytes. Strings in Redis are binary safe, meaning they have a known length not determined by any special terminating characters. Thus, you can store anything up to 512 megabytes in one string.
Example
redis 127.0.0.1:6379> SET name "Adglob" OK redis 127.0.0.1:6379> GET name "Adglob"
In the above example,Ā SETĀ andĀ GETĀ are Redis commands,Ā nameĀ is the key used in Redis andĀ AdglobĀ is the string value that is stored in Redis.
Note ā A string value can be at max 512 megabytes in length.
Hashes
A Redis hash is a collection of key value pairs. Redis Hashes are maps between string fields and string values. Hence, they are used to represent objects.
Example
redis 127.0.0.1:6379> HMSET user:1 username Adglob password Adglob points 200 OK redis 127.0.0.1:6379> HGETALL user:1 1) "username" 2) "tutorialspoint" 3) "password" 4) "Adglob" 5) "points" 6) "200"
The max length of a list is 232 – 1 elements (4294967295, more than 4 billion of elements per list).
Sets
Redis Sets are an unordered collection of strings. In Redis, you can add, remove, and test for the existence of members in O(1) time complexity.
Example
redis 127.0.0.1:6379> sadd Adglob redis (integer) 1 redis 127.0.0.1:6379> sadd Adglob mongodb (integer) 1 redis 127.0.0.1:6379> sadd Adglob rabitmq (integer) 1 redis 127.0.0.1:6379> sadd Adglob rabitmq (integer) 0 redis 127.0.0.1:6379> smembers Adglob 1) "rabitmq" 2) "mongodb" 3) "redis"
Note ā In the above example, rabitmq is added twice, however due to unique property of the set, it is added only once.
The max number of members in a set is 232 – 1 (4294967295, more than 4 billion of members per set).
Sorted Sets
Redis Sorted Sets are similar to Redis Sets, non-repeating collections of Strings. The difference is, every member of a Sorted Set is associated with a score, that is used in order to take the sorted set ordered, from the smallest to the greatest score. While members are unique, the scores may be repeated.
Good info and straight to the point. I am not sure if this is truly the best place to ask but do you folks have any thoughts on where to hire some professional writers? Thanks in advance š