Introduction

Redis1 is an in-memory data structure store that serves as a powerful caching solution for Cerb. While Cerb’s default filesystem caching works well for single-server setups, Redis enables you to scale your deployment across multiple servers while significantly reducing database query traffic. By caching frequently accessed but infrequently changed content (like worker data, groups, and bucket information), Redis helps optimize your application’s performance. This guide will walk you through configuring Redis for caching in Cerb using Docker containers.

Requirements

  • Docker installed and running
  • A working Cerb installation in Docker
  • php8.3-redis package installed (for Ubuntu 24.04)

Local Development Setup

Start Redis on a local port with the configuration:

docker run --name redis-cerb -p 6379:6379 -d redis

Finally, configure Cerb to use Redis by navigating to Setup » Configure » Cache and entering these settings:

  • Host: host.docker.internal
  • Port: 6379

Once connected, Cerb will show: Objects are cached in Redis at host.docker.internal:6379

Verifying the Connection

To verify that Redis is working properly:

Start by connecting to the Redis CLI:

docker exec -it redis-cerb redis-cli
ping

You should receive PONG as a response.

References

  1. Redis: dockerhub - https://hub.docker.com/_/redis