Object Caching vs Page Caching: 10 FAQs [2026]
Compare object caching and page caching to fix slow WordPress sites. Learn what each stores, when to enable them, and how to stack both correctly.

On this page
- What does object caching actually store?
- What does page caching store, and where?
- Which one gives bigger performance gains?
- How do I know which one I need?
- So what if I enable both—do they conflict?
- What causes a 419 page expired error with caching?
- How do I set up Redis for object caching?
- What are safe TTL values for each cache type?
- How do I verify caching is actually working?
- When should I purge or clear the cache?
TL;DR — Key takeaways
- Object caching stores database query results in memory (Redis/Memcached); page caching saves complete HTML output to disk or memory.
- Page caching delivers the biggest speed gains for logged-out visitors; object caching helps logged-in users and reduces database load.
- You can run both simultaneously—page cache serves static HTML while object cache handles dynamic queries that bypass the page cache.
- A 419 page expired error typically indicates session/CSRF token conflicts, not a caching misconfiguration.
Your WordPress site loads slowly even though you enabled caching. The reason: you picked the wrong cache layer for your traffic pattern, or you're running only one when you need both.
Object caching and page caching solve different bottlenecks. One stores query results in memory. The other saves complete HTML pages. Mixing them up wastes server resources and leaves performance on the table. This FAQ answers the ten questions I get most often from hosting customers trying to speed up their sites.
What does object caching actually store?
Object caching stores the results of expensive database queries and computed PHP objects in memory. When WordPress queries for post metadata, user permissions, or widget content, the object cache returns the cached result instead of hitting MySQL again.
Redis and Memcached are the two main backends. Both keep data in RAM, which is orders of magnitude faster than disk. A typical object cache entry might store the output of get_posts() for a specific query, a user's role and capabilities, or the parsed results of a complex taxonomy lookup.
The cache is transient. Restart Redis and the data vanishes. Set a TTL (time to live) too long and you serve stale content; too short and you waste the cache. Most setups use 1-12 hour TTLs depending on how often content updates.
What does page caching store, and where?
Page caching stores the final HTML output after WordPress finishes rendering a page. The cache sits in front of PHP entirely—nginx, Varnish, or a WordPress plugin saves the HTML and serves it directly on repeat requests without touching the database or executing a single line of PHP.
Storage location varies. Disk-based page caches write HTML files to /wp-content/cache/. Memory-based solutions like Varnish or Redis keep pages in RAM. CDN edge caching does the same thing but distributed across geographic regions.
Page cache works only for logged-out visitors viewing identical URLs. Dynamic content, personalized elements, and logged-in users bypass it completely. That's where object caching takes over.
Which one gives bigger performance gains?
Page caching delivers the largest speed improvement for anonymous traffic. Skipping PHP execution and database queries entirely can reduce response time from 800ms to under 50ms. If ninety percent of your visitors are logged out, page caching is the first thing to enable.
Object caching shines for logged-in users and admin operations. When page cache can't help—checkout flows, user dashboards, WooCommerce cart pages—object caching cuts database load by 40-70 percent. I've seen Redis drop admin dashboard load times from 3 seconds to under 1 second on busy membership sites.
How do I know which one I need?
Check your traffic split first. Run this MySQL query to see logged-in vs anonymous sessions: SELECT COUNT(*) FROM wp_users; and compare that to your daily unique visitors. If most traffic is anonymous, prioritize page caching. If you run a membership site, forum, or e-commerce store with heavy logged-in activity, object caching pays off faster.
Look at database slow query logs. High query counts for wp_options, wp_postmeta, or wp_usermeta indicate object caching will help. High CPU usage in PHP-FPM processes with low database load suggests page caching is missing.
For most WordPress sites, the answer is both. Enable page caching for your marketing pages and blog posts, then add object caching to handle the dynamic requests that slip through.
So what if I enable both—do they conflict?
No. They operate at different layers and complement each other. Page cache serves logged-out visitors with static HTML. Object cache handles the database queries for logged-in users who bypass the page cache entirely.
Configuration example: W3 Total Cache or WP Rocket handles page caching, while the Redis Object Cache plugin connects to a Redis server for object storage. The page cache checks first; if the request matches a cached page, it's served immediately. If not (logged-in user, POST request, query string variation), PHP executes and object cache reduces the database queries during that execution.
One gotcha: if you cache user-specific content in the page cache, logged-in users will see cached content meant for other users. Always exclude /wp-admin/, /cart/, /checkout/, and /my-account/ from page caching rules.
What causes a 419 page expired error with caching?
The 419 page expired error in Laravel happens when a form's CSRF token doesn't match the session token. Page caching stores the form HTML with a token that was valid at cache time. When a user submits the form two hours later, the session token has rotated or expired, and Laravel rejects the request.
Workaround: exclude all form pages from page caching. Add /contact/, /login/, and any other form URLs to your cache exclusion list. If you're using Redis for object caching, also switch Laravel's session driver to Redis so session tokens persist across PHP-FPM restarts.
Check your session lifetime in config/session.php. If lifetime is set to 120 (two hours) but your page cache TTL is 86400 (24 hours), users will always hit expired tokens. Match your cache TTL to your session lifetime, or better yet, exclude forms from page caching completely.
How do I set up Redis for object caching?
Install Redis on your server: apt install redis-server or yum install redis, then enable it with systemctl enable --now redis. Verify it's running with redis-cli ping; you should see PONG.
Install the Redis Object Cache plugin in WordPress or add the Predis library via Composer for Laravel. Copy the object-cache.php drop-in to wp-content/ (WordPress) or set CACHE_DRIVER=redis in .env (Laravel).
Configure connection details in wp-config.php:
Test cache hits by loading a page twice, then run redis-cli MONITOR in a terminal. You should see GET and SET commands scrolling by. If you see nothing, check the Redis connection details and make sure the object-cache.php drop-in is in the right place.
- define('WP_REDIS_HOST', '127.0.0.1');
- define('WP_REDIS_PORT', 6379);
- define('WP_REDIS_DATABASE', 0);
What are safe TTL values for each cache type?
Page cache: 24-48 hours for blog posts and static pages. News sites or frequently updated content should use 1-6 hours. Homepage and high-traffic landing pages can go longer if you have manual purge triggers for new posts.
Object cache: 1-12 hours depending on data volatility. User sessions and permissions can cache for 1 hour. Post metadata and taxonomy queries can go 12 hours if your content doesn't change often. WooCommerce product data should cache for 1-4 hours max to keep inventory counts accurate.
Set maxmemory-policy allkeys-lru in redis.conf so Redis evicts the least recently used keys when memory fills up. Without this, Redis will refuse new data once maxmemory is hit, and your cache stops working.
How do I verify caching is actually working?
For page caching, use curl with headers: curl -I https://yoursite.com/ and look for X-Cache: HIT, X-Fastcgi-Cache: HIT, or CF-Cache-Status: HIT depending on your caching layer. Load the page twice; the second request should return a HIT header.
For object caching, enable query monitor plugin (WordPress) or debug bar (Laravel) and check the database query count. Load a page, note the count, then reload. If object caching works, the second load will show 30-70% fewer queries.
Redis-specific test: open two terminals. Run redis-cli MONITOR in one, then load a WordPress page in your browser. The monitor terminal should show GET and SET commands. If it's silent, the object cache isn't connected.
When should I purge or clear the cache?
Purge page cache after publishing new content, updating templates, or changing site-wide settings like menus. Most caching plugins have a 'Purge All' button; use it. For automated deploys, add a cache purge command to your deployment script: wp cache flush or curl -X PURGE https://yoursite.com/.
Flush object cache after plugin updates, theme changes, or database schema modifications. The cached queries may reference old table structures or missing data. Run redis-cli FLUSHALL (purges everything) or wp cache flush for WordPress-specific cache only.
Don't purge on a schedule. It defeats the purpose of caching. Purge reactively when you know content changed, not preventively because you're worried it might be stale. Measure cache hit rates and adjust TTLs instead.
Quick troubleshooting checklist
- Enable page caching first for anonymous traffic using a plugin or server-level cache
- Add object caching (Redis or Memcached) if you have logged-in users, heavy admin activity, or high database load
- Set appropriate cache TTLs: 24-48 hours for pages, 1-12 hours for objects depending on update frequency
- Exclude checkout, cart, and account pages from page cache
- Monitor Redis/Memcached memory usage and set maxmemory-policy allkeys-lru to prevent eviction issues
- Test cache hits with curl or browser dev tools before assuming it's working
- Keep a manual cache purge command ready before major content updates
FAQ
What is the main difference between object caching and page caching?
Object caching stores individual database query results and PHP objects in memory using Redis or Memcached. Page caching saves the entire rendered HTML output of a page to disk or memory. Object cache reduces database queries; page cache skips PHP execution entirely for repeat visitors.
Can I use object caching and page caching together?
Yes, and you should for best results. Page caching serves logged-out users with static HTML. Object caching handles database queries for logged-in users who bypass the page cache, plus admin dashboard operations that always run dynamic PHP.
Why am I seeing a 419 page expired error after enabling caching?
A 419 page expired error in Laravel means the CSRF token expired or doesn't match. This happens when page cache stores a form with an old token, or when the session store (often file-based) doesn't match the cached page. Exclude form pages from page caching or switch to Redis-backed sessions to keep tokens synchronized.
Related articles
- Hosting OperationsSelf-Hosted App Deployment Fails? Check DNS, SSL, Reverse Proxy, and Logs FirstTroubleshoot failed self-hosted app deployments by checking DNS, SSL, reverse proxy routing, container status, logs, and ports.
- Hosting OperationsSelf-Hosted PaaS on a VPS: What to Check Before Installing Coolify, Dokploy, or CapRoverA hosting support checklist for preparing a VPS before installing self-hosted PaaS tools like Coolify, Dokploy, or CapRover.
- Hosting OperationsLinux Server Security Lessons from the Arch Linux Malware Package IncidentPractical Linux server security checklist for VPS admins after package malware concerns, with safe checks, rollback steps, and support guidance.
- Hosting OperationsAWS Lightsail Hong Kong VPS Latency: Practical Hosting Guide for IndonesiaLearn how to test AWS Lightsail Hong Kong VPS latency, compare regions, migrate safely, and troubleshoot hosting performance.
- Hosting OperationsCloudflare Tomorrow Watchlist: A Practical Hosting Operations GuidePractical Cloudflare troubleshooting checklist for DNS, SSL, caching, WAF, origin health, safe testing, and rollback planning.
- Hosting OperationsNetwork Safety Checklist for AI Agent Skills in Hosting OperationsAudit AI agent skills safely with network checks, secret protection, sandbox testing, rollback steps, and hosting support troubleshooting guidance.