This article will introduce you to Redis. Redis is an open source data structure store that you can use as a database, cache, and message broker. It is great to use when tying microservices together, and in data streams.
Key Redis characteristics:
- Fast
- NoSQL database
- Works with many environments
(This tutorial is part of our Redis Guide. Use the right-hand menu to navigate.)
What is Redis?
Redis is an in-memory database. That means all its storage is held in memory—not on a hard drive. Memory enables quick access, and quick searches, but is limited by space.
In the database architecture, Redis is usually positioned between the client and the database to relieve the load off your NoSQL database or application.
Redis is open-source software that is released under a BSD 3-cause license, a specific type of permissive free software licenses. Redis began when developer Salvatore Sanfilippo needed to improve scalability on his website. He soon open-sourced the platform. Today a core project team develops and maintains Redis, which has been sponsored by Redis Labs since 2015.
Redis use cases
Top use cases for Redis are:
- Queues
- Publish/subscribe (Pub/sub)
- Real-time analytics
- Machine learning
- Geospatial processing
- Leaderboards/counting
- Session cache
- Full page cache
Redis is desirable because its speed and ease complement the increasing use of data streams, signaled from IoT devices, and the business desire for real-time analytics. Its speed and NoSQL structure make it a good choice for both real-time processing and increasing the amounts of data and types that need to pass through it.
Redis can:
- Decrease the load from the database or application
- Decrease data access latency when caching
- Quickly process a high volume, variety, and velocity of data (the 3 V’s) for machine learning
- Pair easily with streaming solutions like Amazon Kinesis, Apache Kafka, and Google Storage
Redis works with many languages
Redis will work with many different languages, making it easily adoptable by whatever the developer is familiar with using or the language the company has adopted.
- Julia
- Ruby
- Rust
- Python
- R
- Java
- C
- Go
- Perl
- And so many more……
Who uses Redis?
Many companies have adopted Redis, including these big, global organizations. This list offers a look at many more companies who use Redis.
Common Redis commands
Redis has commands available to work with its data types: Strings, hashes, lists, sets, sorted sets, bitmaps, and hyperloglogs.
These are sort of standard commands available in most languages that deal with data structures.
Strings
APPEND | Appends value to key |
SET | Set value in a key |
GET | Get value in key |
INCR | Increment value in key |
Lists
RPUSH | Put new value at end of list |
LPUSH | Put new value at start of list |
LINDEX | Get an element from a list by its index |
LPOP | Remove the first element of the list and return it |
Sets
SADD | Add the given value to the set |
SCARD | Get the number of members in a set |
SUNION | Combine two or more sets and returns list of all elements |
SMOVE | Move a member from one set to another |
Explore the rest of our Redis Guide for more detail, or check out this cheat sheet at GitHub.
Installing Redis
Ready to get started with Redis? We show you how to install Redis in our next article. Or, you can follow these links to a web page where you can look at the different download options:
Related reading
- BMC Machine Learning & Big Data Blog
- MongoDB Guide, a 30-part article and tutorial series
- Docker Commands: A Cheat Sheet
- CAP Theorem for Databases: Consistency, Availability & Partition Tolerance
- ACID: Atomic, Consistent, Isolated & Durable