Redis
Redis is Non-SQL database or sometimes we called in-memory database.
Non-SQL databases have different types: Key-Value (Redis), Document (MongoDB), Graph - (Neo4j).
Redis is what we call a key-value store (similar to how we handle JS Object)
Characteristics:
In-memory database which is very fast
Use for short lived data in our applications, like sessions or web page headcounts
Don't have large data sets like MongoDB. Only small data which allow us to keep it in machine memory and not on disk
Even though the data is stored in memory, it does take a snapshot occasionally to save the current data contents onto the disk which, is great to recover from, when there's unexpected shutdowns. Although we might lose the some/ latest information.
Handle 5 data types: string, hash, list, set and sorted set.
Hash:
List:
Insertion is really really fast. Useful when you have long list and you need to add element quickly.
Take a bit of time when searching. Use sorted list which is better for searching.
Set and Sorted Set:
Set is unordered collection of string and sorted set is ordered. In set, there is no duplicate value.
The difference between set and sorted set is in sorted set, for every member of a sorted set is associated with a score and this score allows it to be ordered from smallest to greatest.
Last updated