Need a CS-Cart enhancement or full project support?

I’ll get up to speed on your project and take care of the technical workload.

Contact me
← All articles

Redis in CS-Cart: How to Enable Faster Caching

A practical guide to setting up Redis as the built-in CS-Cart cache backend, checking that it works, and rolling back if needed.

As an online store grows, file-based caching can put extra pressure on the disk. Redis keeps data in server memory and can be used as the built-in cache backend in CS-Cart.

Redis will not solve every performance problem. A slow theme, heavy images, poorly optimized customizations, and slow external requests will still need attention. But Redis can reduce disk and database load where CS-Cart already uses caching. CS-Cart supports Redis as a cache backend.

When Redis is worth considering

Redis is usually worth considering if:

  • your store runs on a VPS or dedicated server;

  • you have a large catalog and many add-ons;

  • the storefront or admin panel sometimes responds slowly;

  • your project uses multiple web servers.

For a small store, the difference may be barely noticeable. In that case, measure actual page speed and server load first.

What you need

Before you start, make sure you have SSH access to the server, access to config.local.php in the store root, and a backup of that file.

It is usually simplest to run Redis on the same server as the store. Do not expose the Redis port to the internet: in a typical setup, it should be reachable only locally.

Install Redis

On Ubuntu or Debian:

sudo apt update
sudo apt install redis-server
sudo systemctl enable --now redis-server

Check that the service is running:

redis-cli ping

If everything is working, the command returns:

PONG

If you do not get PONG, troubleshoot Redis before changing the store configuration.

The PHP environment that runs CS-Cart must also support Redis. Installing the Redis server alone does not mean the store can connect to it.

Configure CS-Cart

Open config.local.php and add:

$config['cache_backend'] = 'redis';
$config['cache_redis_server'] = '127.0.0.1';
$config['cache_redis_global_ttl'] = 0;

127.0.0.1 tells CS-Cart to connect to Redis on the same server. It is the simplest starting point.

Setting cache_redis_global_ttl to 0 does not impose a global expiration time on all entries. If server memory is limited, discuss TTL settings with your administrator: a very short TTL reduces the benefit of caching, while a long one can use too much memory. See the CS-Cart configuration documentation.

Clear the cache

After saving the settings, clear the cache from the CS-Cart admin panel.

The first page loads afterward may be no faster, or even slightly slower, while the store repopulates the cache. Check performance after navigating through several storefront and admin pages.

Check your store

After switching, open:

  • the homepage;

  • several category pages;

  • a product page;

  • search;

  • the cart;

  • the admin panel.

If the storefront and admin panel work without errors, the connection appears to be working.

If possible, place a test order on a staging storefront. This helps confirm that caching has not affected the main purchasing flow.

How to check whether Redis is being used

You can inspect statistics on the server:

redis-cli info stats

Two useful counters are:

  • keyspace_hits — requested data was found in the cache;

  • keyspace_misses — requested data was not in the cache.

You can also check whether any keys have been created:

redis-cli dbsize

There may be only a few keys right after enabling Redis: the cache fills as the store is used.

What Redis will not fix

Redis is no substitute for a performance audit. It will not fix:

  • oversized images;

  • a slow theme;

  • an unoptimized add-on;

  • slow requests to external services;

  • an overloaded database;

  • an underpowered server.

If pages are still slow, find out where the time is spent: PHP, the database, the frontend, or an external service.

If an error appears after switching

Switch back to file caching in config.local.php:

$config['cache_backend'] = 'file';

Then clear the cache from the admin panel.

Common causes include:

  • Redis is not running;

  • PHP does not support Redis;

  • the server address is wrong;

  • the web server cannot connect to Redis;

  • there is a typo in the configuration.

Redis is a useful baseline improvement for a CS-Cart store that is starting to face heavier load. Enable it, check the storefront, and measure real page speed. If performance does not improve, look for the specific bottleneck rather than adding another layer of caching.

LET’S GET STARTED

Grow your project with Larionov.tech

Together, we’ll build steady and sustainable growth for your business.

  • Fixed price before work starts
  • A contract for every project
  • A result guarantee
Preferred contact method