They are basically a key values that store and able to retrieve data for a given key. And Redis will be able to store data in different data types such as:
- Strings
- Sets
- Hashes
- Sorted sets
- Transactions
The first and most basic data type is string data types. The strings in Redis doesn't have to be strings of text. Data stored as a string can basically contain any kind of data. A common use of strings in Redis is to store whole objects in a serialized format and can also append data to a string using APPEND.
Redis sets are just a collection of strings. But Redis sets doesn't allow for any strings to be repeated within the set. This can be useful for a number of reasons. And doesn't need to check if an element that sets before adding it. These sets only store a single copy of any string, adding, removing and testing for existence of a member can be done in constant time regardless of the number of elements in the sets. These means set operations are really fast. Sets also allows for many mathematical set operations like finding unions, intersections, or the difference to all can be done very quickly. Sets also allows for many mathematical sets operations, like finding unions, intersections.
Hashes in Redis are some what like nested key values stores. Hashes basically lets the clients to map to string field to a string values. This work well for representing objects that might have multiple filed that are able to access while storing data in Redis. Hashes are also very efficient ways for storing data in Redis since as long hash doesn't have more than one hundred fields in sorting a ways that it doesn't end up taking very much space at all. Because Redis is optimized for hashes.
Sorted sets might seems like a strange data types to includes in Redis. And basically sounds like sets sorted. But sorted sets can be useful to represent data that naturally lends itself to be unique and sorted like a high score board for a game.Sorted set are essential sets in which each member has an additional item called a score. This score determine the order in which that items is stored in that set. Sorted sets are very fast at adding,removing or updating elements.
Redis will supports for transactions and can group multiple Redis commands together to insure that they get executed as single unit, which will not be interrupted and all the the commands will be executed. Another way to say this that Redis transactions are atomic. In Redis transactions are started using the multi command. Any commands entered after this point are cued by Redis until either the exact or Discard commands. There is one really important thing to understand about Redis transactions and are actually queuing up the commands for the transactions, when the user run the transaction it will actually fail and it won't run any of the commands. The only time that res will actually run commands after an error has occurred is if that error occurs when the transaction is actually executing as opposed to when the commands are being queued up to be executed.