Redis Caching Setup for OpenCart
Redis caching setup for OpenCart
The file-based cache that ships by default performs acceptably on a small store. As the catalogue and traffic grow it becomes a bottleneck in its own right: every cache lookup is a disk operation, and there are dozens per page.
What is included
- installing and configuring Redis with a memory limit and an eviction policy;
- connecting the store to Redis instead of the file cache;
- a separate key namespace where several sites share a server — otherwise they overwrite each other's cache;
- cache lifetime tuned to how often your catalogue changes;
- session storage in Redis, where appropriate;
- checking the cache hit rate: if it is low, the setup achieves nothing.
What nobody warns you about
OpenCart's built-in cache invalidation is written for file storage: it deletes a group of keys by pattern. On Redis that does not work — only an exact key is removed. The consequence: you change a product and the site keeps showing the old price until the cache lifetime expires.
So connecting Redis is not just "switch the driver in the config" — it also means verifying that cache clearing after an edit genuinely works.
When Redis is not needed
If the store has a few hundred products and a dozen visitors an hour, you will not notice a difference. Redis pays off where there is load: a large catalogue, active traffic, heavy category pages.
Tags: redis, opencart, cache, performance, ttfb