02.06.2026
106
2 min read

Redis Caching in OpenCart 3.x: Setup and Tuning

Redis Caching in OpenCart 3.x: Setup and Tuning
Contents

    A slow OpenCart is one of the most common complaints store owners have. One of the most effective ways to speed it up is Redis. Here it is, step by step.

    Why Redis rather than file cache

    Stock OpenCart uses a file cache in storage/cache/. Redis holds data in RAM, which is 10–100× faster to read than disk. The difference is especially clear on stores with 1,000+ products.

    Step 1: install Redis

    apt install redis-server php8.3-redis
    systemctl enable --now redis-server

    Check that Redis is listening on localhost:

    redis-cli ping
    # PONG

    Step 2: configure redis.conf

    maxmemory 256mb
    maxmemory-policy allkeys-lru
    bind 127.0.0.1
    requirepass your_strong_password

    Step 3: connect it to OpenCart

    In config.php, change the storage driver:

    define('CACHE_DRIVER', 'redis');
    define('CACHE_HOSTNAME', '127.0.0.1');
    define('CACHE_PORT', 6379);
    define('CACHE_PASSWORD', 'your_strong_password');

    Step 4: move sessions to Redis

    In php.ini or the PHP-FPM pool configuration:

    session.save_handler = redis
    session.save_path = "tcp://127.0.0.1:6379?auth=your_strong_password"

    Monitoring the hit rate

    redis-cli info stats | grep keyspace_hits
    redis-cli info stats | grep keyspace_misses

    Target: a hit rate above 90%. Below that, raise maxmemory.

    The result

    Configured properly, Redis brings TTFB down from 800–1500 ms to 50–150 ms, and cuts load on MariaDB by 40–70%.

    Want me to set up Redis for your OpenCart? Get a quote.

    Related Articles
    Write a review
    Please login or register to review