The art of caching, with Redis

DLT Labs
2 min readNov 6, 2019

Recently in our project, we encountered the problem of longer response time. This was due to a rapid increase in the data of our product which led to heavy database requests and huge costs. Until now, we were only using the database for storing data.

After doing some research, we came to know we can save the number of requests to the database and finally decided to do something known as Caching.

What is Caching?

Caching is nothing but a process of storing data in the cache memory, which is also known as CPU memory. The main purpose of the cache is to reduce the time needed to access data stored outside of the application’s main memory space. So data can be served faster by the cache.

The next question we had was ‘ which in-memory database will be suitable for us’.

There are many in-memory databases we could choose from — Redis, Memcached, CouchDB, NCache, etc.

In our case, we went ahead with Redis.

6 reasons we chose Redis…

  1. No SQL database so no need to save data in SQL format
  2. Easy to install, and easy to use
  3. Open source and stable
  4. In memory with high availability
  5. It supports very high throughput
  6. It is being supported by many programming languages — Javascript(Node js), C, C++, PHP, Perl, Java, Python, and many other languages.

The 5 datatypes supported by Redis:

  1. Strings
  2. Hashes
  3. Lists
  4. Sets
  5. Sorted Sets

Redis keys

Redis keys are used for handling keys in Redis. We list a few basic keys commands every Redis user must know:

Redis is powerful and this was just an introduction. We’ll be diving deeper into it in our upcoming blogs.

Stay Tuned!

Author — Ritu Goel, DLT Labs

About the Author: Ritu Goel is a software developer at DLT Labs™. She is skilled with Node JS, JavaScript, SQL, Redis and Mongo DB.

DLT Labs

DLT Labs is a global leader in Distributed Ledger Technology and Enterprise Products. To know more, head over to: https://www.dltlabs.com/