Object Caching and Redis for Magento (Firstserv Guide)

What is Object Caching?

Object caching improves website performance by storing the results of frequent or resource-intensive database queries in memory.

Instead of repeatedly querying the database, cached data can be retrieved instantly, which:

✅ Reduces database load
✅ Speeds up page generation
✅ Improves overall performance


What is Redis?

Redis (Remote Dictionary Server) is an open-source, high-performance, in-memory data store used for:

  • Caching
  • Database storage
  • Message handling

Redis supports a wide range of data structures, including:

  • Strings
  • Lists and sets
  • Hashes
  • Advanced data types for efficient queries

In a hosting environment, Redis acts as a fast caching layer that works alongside your database (MySQL/MariaDB) to significantly boost application speed.


Enabling Redis on Firstserv Hosting

Redis is available on eligible Firstserv hosting plans and must be enabled via your hosting control panel.

👉 Please refer to the Firstserv Redis setup guide for instructions on enabling the service before continuing.


How to Enable Redis Caching for Magento

Once Redis is enabled, you can configure Magento to use it for caching.


Step 1: Get Your Redis Socket Path

  1. Log in to cPanel
  2. Navigate to Advanced → Redis Manager
  3. Copy your Socket Path (for example:
    /var/kredis/youraccount/redis.sock
    ```)
    

Step 2: Access Terminal

  1. In cPanel, go to Advanced → Terminal
  2. Launch the terminal session

Step 3: Run the Magento Configuration Command

Navigate to your Magento installation directory if needed, then run:

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

🔧 Replace:

/var/kredis/YOURSOCKETPATH/redis.sock

with your actual Redis socket path copied earlier.


Important Notes

  • Redis uses a UNIX socket, so the port must be set to 0
  • Ensure Redis is enabled before running the command
  • This configuration allows Magento to use Redis for object caching

Benefits of Redis for Magento

Using Redis with Magento provides:

✅ Faster page load times
✅ Reduced database queries
✅ Improved performance under load
✅ Better scalability for busy stores


Summary

To enable Redis caching for Magento:

  1. Enable Redis in cPanel
  2. Copy your Redis socket path
  3. Run the Magento configuration command via Terminal
  4. Confirm caching is active

If you need help enabling Redis or configuring Magento caching on your Firstserv hosting, the Firstserv support team is always available to assist.

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing LiteMage caching for Magento v2

LiteSpeed & LiteMage for Magento (Firstserv Guide) All Firstserv shared and business...

Configuring Elasticsearch with Magento 2.4

Setting Up Elasticsearch for Magento 2.4 (Firstserv Guide) Magento 2.4 requires...

Installing LiteMage caching for Magento v1

LiteSpeed & LiteMage for Magento 1 (Firstserv Guide) All Firstserv shared and business...

Configuring Opensearch with Magento 2.4

Setting Up OpenSearch for Magento 2.4 (Firstserv Guide) Magento 2.4 requires a search engine...