Configuring Redis caching in Magento

What is object caching?

An object cache stores the results of expensive and/or frequent database queries in a way that makes them easy to retrieve, and eliminates the need for repeated access to the database. Object caching greatly reduces the time it takes to retrieve query results.

What is Redis?

Redis (Remote Dictionary Server) is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.

It supports data structures such as strings, hashes, lists, sets, range queries, bitmaps, hyper loglogs and geospatial indexes with radius queries.

In its simplest form, Redis is a caching system that can be combined with MySQL or MariaDB to optimize the application level speed.

How do I enable Redis?

We have a separate guide that covers enabling Redis on your Premium PCI-DSS compliant hosting account (Link opens in a new tab).

How do I enable Redis Caching for Magento?

In order to follow this guide, you will need to be able to access your cPanel account (Link opens in a new tab).

Enabling redis caching is a simple process. Once you have enabled redis on your premium PCI-DSS compliant hosting account, you will need to run the following command in your Terminal:

bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server='/var/kredis/YOURSOCKETPATH/redis.sock' --cache-backend-redis-port=0

  1. Login to your cPanel account
  2. Navigate to the Advanced section and click Redis Manager
  3. Copy your Socket path as shown i.e. /var/kredis/enableredis/redis.sock
  1. Navigate to the Advanced section and click Terminal

  1. Run the following command within the terminal, ensuring that you replace /var/kredis/YOURSOCKETPATH/redis.sock with your socket path as shown in the previous steps:

bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server='/var/kredis/YOURSOCKETPATH/redis.sock' --cache-backend-redis-port=0

  1. Done!


How did we do?


Powered by HelpDocs (opens in a new tab)
© Krystal Hosting Ltd 2003–