About Redis Commands & Data Structures

Discuss the data structures that make Redis so popular

Check out available commands and read the introduction to Redis data types.

A post was split to a new topic: Is there a way to remove the Redis keys of completed jobs?

Redis Data Structures make the entire ecosystem go round!


Thank you for sharing!

1 Like

A post was split to a new topic: Whats the best one for table like data storage?

the redis data structture is super interesting to learn, i love working with the Docker container and redis modules and learning interesting things, on the other hand I find that the LPUSH; RPUSH commands are vey practical to add elements or extract with LRANGE.


What is the waiting time for a key?

When the Redis password expires, send some kind of automated message to warn the user that the password will expire?

We know that Redis saves the expiration date for a key.

1 Like

A post was split to a new topic: Why is HyperLogLog it’s own data structure?

ordered sets can sometimes be confused if you don’t read and analyze the documentation well, they are similar to a mix between a set and a hash, ordered sets are made up of string elements which are not repeated, this leads to the conclusion that sets ordered are in turn a set.

Redis is unique since string values ​​are associated in traditional key value stores, in Redis the value is not limited to a single simple string but can also contain complex data structures.

1 Like

Talking about commands and data structure that made Redis so popular, I am going to start with this. There is this big misconception about what Redis is. So many including myself used to think Redis is only an in-memory database that cannot persist data and is only good for caching. So going by this, I believe the “set” or “setex” commands when used within the context of caching is actually one of the few ones that made Redis so popular.

I personally, came to know about Redis through the caching concept, it is then after I explored for a little while I discovered that Redis can do so much more than I was made to believe and as a matter of fact I am still discovering what Redis is capable of.

So the string data structure and the set commands are in my opinion what made Redis so popular.



I agree with your sentiment. I was first exposed to Redis when looking for a memcached alternative. Redis can do everything that memcached can (in-memory, key-value data store), Redis is so much more being a data structure store/server.


It strikes me that the value of Redis is not limited to a simple data string, but can also contain more complex data structures, this makes Redis different from other database systems.
In the Redis compliant data structures, the ones I like the most are: Ordered sets, Hyperloglogs, and hashes.


I stay with the introductory list as it is a topic which I note is essential to have a clear structure.

the lists have special characteristics to implement queues, in general it works as a building block for communication systems.

Redis adds commands called BRPOP and BLPOP, capable of blocking if the list is empty.

Something to keep in mind in Redis lists, is that the properties of a list implemented using an Array are totally different from a list implemented using a linked list, these are details that if not taken into account at the beginning can confuse and delay the work to be done.

Within the alteration and query of key spaces there are commands that are not defined in particular types, but work to interact with key spaces and can be used with keys of any type, for example Exists and DEL.

You have to study the commands very well to know which one suits us best and is more in line with the work or the action to be performed inside the container.

I would like to talk a little bit about the INCR command which parses the value of the string as an integer, which increments by one and finally sets a value obtained as the new value.

What is the meaning that INCR is atomic? that even if multiple clients issuing INCR against the same key would never enter a race condition.

example: it will never happen that client 1 reads “10”, client 2 reads “10” at the same time, both increase to 11 and set the new value to 11. The final value will always be 12 and the read-set operation incrementing is done while all other clients are not executing a command at the same time.