Redis = Remote Dictionary Service
If you can list all complex use case to REDIS and discover you aren’t at risk of running out of RAM by using REIDS there is a great chance you should probably use REDIS.
It’s a “NoSQL” key-value data store. accurately, it is a data structure server.
Not like other NO-SQL DB i.e MongoDB (which is a disk-based document store), though MongoDB could be used for similar key/value use cases.
The nearest analog is probably to think of REDIS as Memcached, but with built-in persistence (snapshotting or journaling to disk) and more datatypes.
Those two additions may seem pretty minor, but they are what make Redis pretty incredible. Persistence to disk means you can use Redis as a real database instead of just a volatile cache. The data won’t disappear when you restart, like with memcached.
The additional data types are probably even more important. Key values can be simple strings, like you’ll find in memcached, but they can also be more complex types like Hashes, Lists (ordered collection, makes a great queue), Sets (unordered collection of non-repeating values), or Sorted Sets (ordered/ranked collection of non-repeating values).
This is only the tip of the Redis iceberg, as there are other powerful features like built-in pub/sub, transactions (with optimistic locking), and Lua scripting.
The entire data set, like memcached, is stored in-memory so it is extremely fast (like memcached)… often even faster than memcached. Redis had virtual memory, where rarely used values would be swapped out to disk, so only the keys had to fit into memory, but this has been deprecated. Going forward the use cases for Redis are those where its possible (and desirable) for the entire data set to fit into memory.
Redis is a fantastic choice if you want a highly scalable data store shared by multiple processes, multiple applications, or multiple servers. As just an inter-process communication mechanism it is tough to beat. The fact that you can communicate cross-platform, cross-server, or cross-application just as easily makes it a pretty great choice for many many use cases. Its speed also makes it great as a caching layer.
10 Common Web/API Use Cases Solved In Redis that can be implemented in your next app
Common Redis primitives like LPUSH, and LTRIM, and LREM are used to accomplish tasks programmers need to get done, but that can be hard or slow in more traditional stores. A very useful and practical article. How would you accomplish these tasks in your framework?