Codegea

Development

Custom software developmentSystems, platforms and integrations built around your operationCorporate websitesProfessional, fast and built to inspire trustOnline storesCatalog, payments and shipping ready to sell 24/7WooCommerceFast WooCommerce stores with each country’s payments and invoicingLanding pagesA page focused on one goal: turning visitors into customersMobile appsCustom iOS and Android apps that put your business in your customers’ pockets

Integration and CMS

CMS integrationsWordPress, Strapi, Directus and Arc XP connected to your whole ecosystemArc XPSupport, implementation and integrations for the media platformMigrationsMigrate your site, platform or database without losing anything

Growth and infrastructure

AI automationTechnology does the repetitive work and your team focuses on what mattersOn-page SEOBe found and recommended by Google: technical and content optimizationServers & hostingFast, secure servers monitored 24/7
RetainerYour dev team, by the monthFrom 20h a month. Fixed fee.
An AI quoting tool to quote services in minutesProfessional quotes in minutes, with projects, sellers and payments tracked in one place.See the case

By type

EcommerceStores and catalogsCorporate sitesBrand and lead genPlatforms & appsCustom software

Explore

All projectsCases and resultsClientsWho trusts usRetainerMonthly dev team

Blog

All articlesGuides and opinionNewsletterOne email a monthContactWe reply in 24h

Latest articles

Integrating Piano, Cxense and Google Ad Manager with Arc XPCMS · 2026-10-13How to migrate from WordPress to Arc XP without losing SEOCMS · 2026-10-13Arc XP vs WordPress for a digital media outlet: when to make the jumpCMS · 2026-10-13
NewsletterJoin our newsletterPractical web, SEO and AI notes.
ServicesCustom software developmentCorporate websitesOnline storesWooCommerceLanding pagesMobile appsCMS integrationsArc XPMigrationsAI automationOn-page SEOServers & hostingYour dev team, by the month
ProjectsProfessional quotes in minutes, with projects, sellers and payments tracked in one place.EcommerceCorporate sitesPlatforms & appsAll projectsClientsRetainer
Retainer
BlogAll articlesNewsletterContactIntegrating Piano, Cxense and Google Ad Manager with Arc XPHow to migrate from WordPress to Arc XP without losing SEOArc XP vs WordPress for a digital media outlet: when to make the jumpJoin our newsletter
ESEN
Let's talk

Servers

Server caching: Redis, Varnish and OPcache, what each one does

OPcache, Redis and Varnish: what each server cache does, how they differ and how to combine them to speed up WordPress, WooCommerce and Laravel.

Derian Pinto · Founder & Full Stack Developer2026-08-174 min
Server caching: Redis, Varnish and OPcache, what each one does

When a website is slow, the first reflex is to blame the hosting or install a cache plugin and cross your fingers. But "cache" is not a single thing: on a server several layers coexist that store already computed results so work is not repeated. Three of the most important are OPcache, Redis and Varnish, and although all three cache, each one solves a different problem. Understanding which does what is the difference between truly optimizing and poking around blindly.

I will explain it without smoke, focusing on what each one stores and when it suits you, so you know what to ask for or what to check on your server.

OPcache speeds up PHP, Redis avoids going to the database and Varnish serves whole pages without touching PHP. They do not compete: they complement each other.

Why caching is the most profitable lever

Generating a dynamic page, whether in WordPress, Laravel or whatever you use, means running code, querying the database and building the HTML on every visit. A cache stores the result of that work to reuse it. It is, by far, the improvement with the best effort-to-result ratio, and it connects directly to your web performance and, by extension, to your Core Web Vitals.

OPcache: caches compiled PHP

PHP is an interpreted language: on every request it reads the file, compiles it into internal instructions (opcodes) and only then runs it. OPcache keeps those already compiled opcodes in memory, so PHP skips the compile step on every visit. It is the most basic cache and should almost always be on. It does not store data or HTML: only compiled code.

Checking whether it is active and whether Redis responds takes a couple of commands:

# Check whether OPcache is active
php -m | grep -i opcache
# Test the Redis connection
redis-cli ping

Redis: caches data and queries

Redis is a key-value store that lives in memory. In WordPress it is used as an object cache: it stores the results of database queries and objects that would otherwise have to be recalculated on every load. In Laravel it is used for cache, sessions and queues. What it avoids is hammering MySQL over and over with the same queries, which is one of the most common bottlenecks on sites with traffic.

In WordPress, enabling Redis as an object cache usually starts with a few lines in wp-config.php and a plugin that acts as the bridge:

define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_CACHE', true);

Varnish: caches whole pages

Varnish is an HTTP accelerator placed in front of your web server. It stores the full HTML response and serves it to the following visitors without touching PHP or the database. For content that does not change every second (blogs, corporate sites, catalogs) it is brutal: millisecond responses even with thousands of visits. The challenge appears with personalized content, carts or private areas, where routes must be excluded so one user is not served another’s page.

The three at a glance

Layer

What it stores

Where it acts

Shines in

OPcache

Compiled PHP code (opcodes)

Inside PHP itself

Any PHP site, always

Redis

Data, objects, queries and sessions

Between the app and the database

WordPress with many queries, Laravel, APIs

Varnish

Full HTML pages

In front of the web server

Heavy traffic and slowly changing content

What about plugin page caching?

Plugins such as LiteSpeed Cache or WP Rocket also do page caching, like Varnish but from inside WordPress. On shared hosting it is usually your only option and works very well. On a VPS you have the freedom to combine: OPcache and Redis at server level, plus a page cache (Varnish or the plugin’s). You do not need to have them all; you need the ones your case calls for.

How to combine them for your case

Your case

Recommended combination

Blog or corporate site on WordPress

OPcache plus page cache (plugin or Varnish)

WooCommerce store

OPcache plus Redis (object cache) plus page cache with the cart and checkout excluded

Laravel application

OPcache plus Redis for cache, sessions and queues

Heavy traffic and stable content

All three: OPcache, Redis and Varnish

In my experience

In my experience, 80 percent of the benefit comes from the simplest things: enabling OPcache (often it is already there but poorly configured) and adding Redis as an object cache if the site runs many queries. I leave Varnish for when traffic justifies it, because its fine configuration, especially with carts and private areas, is more work than people think. And an important warning: caching hides problems, it does not cure them. If your site is slow because of badly written queries or an overloaded server, fix that first. A well-placed cache on a healthy base flies; on a broken base it only disguises. All of this, of course, lives or dies with good server maintenance.


Do you have a VPS and do not know whether it is well used? At Codegea we configure and maintain servers with OPcache, Redis and Varnish tuned for WordPress, WooCommerce and Laravel, so your site runs fast without scares. Write to me and we will review it.

Share this article?LinkedInWhatsAppX

Written by

Derian Pinto

Founder & Full Stack Developer

Founder of Codegea. Builds custom websites, stores and platforms, and integrates and supports Arc XP for media companies.

Join our newsletter

An email with news and practical web, SEO and AI notes. No spam, unsubscribe anytime.

Shall we build your project?

Need help? Chat with us