Fundamentals of Redis for Caching — All You Need to Know as a Developer

Learn the most common use cases of Redis

Lynn G. Kwong
14 min readAug 22, 2021

Redis, which stands for Remote Dictionary Server, is an open-source in-memory data structure store that can be used as an in-memory key-value database, caching system, and pub/sub message broker. Redis is special in that all its data is stored in memory rather than on disk which makes it extremely fast and is a popular option for caching.

Photo by Tyler Clemmensen on Unsplash.

Redis is similar to Memcached, which as the name indicates is also an in-memory key-value data storage. However, Redis has more advanced features which makes it applicable to more scenarios. Unlike Memcached which only supports strings, Redis supports a variety of data structures including lists, sets, sorted sets, hashes, etc. Besides, Redis also supports snapshots, transactions, pub/sub, etc.

To start using Redis, you need a Redis server. For learning purposes, you can install Redis on your local machine or use a Docker container. For production purposes, you need to install Redis on a dedicated server or use third-party hosted Redis servers, such as GCP Memorystore for Redis or Amazon ElastiCache.

In this tutorial, we will install Redis on our local machine. If you are using Ubuntu, you can install Redis in this way:

--

--

Lynn G. Kwong

I’m a Software Developer (https://youtube.com/@kwonglynn) keen on sharing thoughts, tutorials, and solutions for the best practice of software development.