Skip to main content
KadiCache
Browse 37 Docs Guides & Search

7-Driver Persistent Object Cache: Redis, Relay, Memcached, APCu & SQLite

Configure and benchmark Relay, PhpRedis, PhpStreamRedis, Memcached, APCu, SQLite WAL, and Sharded File with 200-key Batch Prefetch, Split Alloptions, and AutoloadAnalyzer.

Cache/ObjectCache/ObjectCacheEngine.phpCache/ObjectCache/ObjectCacheDropinManager.phpCache/ObjectCache/AutoloadAnalyzer.phpCli/ObjectCacheCli.php
WP Admin -> KadiCache -> Object Cache
MODULE 09 · 2X RETINA
Persistent Object Cache engine with Smart Route Prefetching, race-free split_alloptions, and 5-second circuit breaker.2880×1840 WebP
Quick Summary · 30-Second Operational SpecSource-Verified Guide
WP Admin Path
WP Admin -> KadiCache -> Object Cache
Expected Outcome
7 Native Drivers · 1-RTT 200-Key Prefetch · 5s Circuit-Breaker
Key Marker / Engine
wp-content/object-cache.php | wp kadicache object-cache status
  • Ships 7 production backends (ObjectCacheEngine.php) in 100% Free Core: RelayDriver, PhpRedisDriver, PhpStreamRedisDriver (zero PHP extension needed!), MemcachedDriver, ApcuDriver, SqliteDriver (WAL), and FileObjectDriver.
  • Includes Smart Route Prefetching (200 keys in 1 MGET round-trip), Atomic Split alloptions (fixing WordPress #31245 race conditions), and igbinary + zstd/zlib/lz4 compression at $0.
  • Audits bloated autoload = yes/on rows in wp_options via AutoloadAnalyzer.php directly inside the Object Cache tab and wp kadicache object-cache info.
  • Protects site uptime with a 5-second automatic circuit-breaker so a restarted Redis or Memcached daemon never takes down wp-admin or WooCommerce checkout.
ObjectCacheEngine.php combines L1 request RAM, 1-RTT 200-key Route Prefetch, 7 persistent backends, and a 5-second automatic circuit-breaker.Click to zoom

When Persistent Object Caching Accelerates WordPress the Most#

HTML Page Caching (advanced-cache.php) makes anonymous repeat visits practically instantaneous (~14 ms), but four critical parts of every WordPress + WooCommerce site cannot use shared HTML page cache:

  1. Logged-In WP Admin, Gutenberg Editing & Order Management: Every admin screen runs 60 to 180 SQL queries for capabilities, options, menus, and WooCommerce analytics.
  2. Dynamic WooCommerce Cart, Checkout & My Account Flows: Active checkout calculations, shipping rate lookups, tax queries, and coupon validations execute live PHP on every step.
  3. REST API, admin-ajax.php, WP-Cron & Action Scheduler Workers: Background webhooks and subscription renewals hammer MySQL continuously.
  4. Cold HTML Cache Misses & Sitemap Preload Builds: Faster database object lookups cut uncached HTML generation time in half.

Installing KadiCache’s wp-content/object-cache.php drop-in (ObjectCacheDropinManager.php) stores deserialized WordPress options, posts, terms, user meta, and transients in sub-millisecond memory—eliminating 70% to 92% of repetitive SQL queries on every dynamic PHP request.

Choosing the Right Backend Among All 7 Drivers#

Inside WP Admin -> KadiCache -> Object Cache, KadiCache probes installed PHP extensions and local sockets automatically (auto mode) or lets you pick any available driver explicitly:

Driver (--driver=)Underlying StorageBest Hosting EnvironmentStandout Advantage
relayCacheWerk Relay C extension + Redis/ValkeyHigh-traffic single/multi-node VPS & EnterpriseShared in-process C memory + Redis invalidation (~0.05 ms reads)
phpredisNative ext-redis C extension (TCP / TLS / Unix socket)Cloudways, VPS, Kubernetes, AWS ElastiCache, ValkeyFastest standard network driver; native MGET & igbinary/zstd
redis-socket / StreamPhpStreamRedisDriver (pure PHP RESP socket)cPanel / Plesk hosts running Redis without ext-redisConnects to Redis/Valkey over TCP or /var/run/redis/redis.sock with 0 extensions
memcachedext-memcached binary protocolSiteGround-style or legacy multi-web Memcached poolsMulti-get batching (getMulti) across distributed Memcached nodes
apcuext-apcu shared PHP-FPM worker RAMSingle-server NVMe VPS without Redis installedZero socket serialization overhead (~0.02 ms in-RAM reads)
sqlitePDO_SQLite / SQLite3 in WAL modeShared hosting without Redis, Memcached, or APCuConcurrent WAL reads on local NVMe faster than remote MySQL sockets
fileSharded atomic disk store (FileObjectDriver)Universal fallback environmentAtomic lock-safe persistence anywhere PHP can write files
FIG 01Configuring Redis host/port/socket, Smart Route Prefetching, Atomic Split Alloptions, and Serializer/Compression inside WP Admin -> KadiCache -> Object CacheZoom 2x

Configuring Connection Parameters & wp-config.php Constants#

You can configure Redis/Memcached connection details (127.0.0.1:6379, Unix socket path /var/run/redis/redis.sock, authentication password, ACL username, database index 0–15, and key prefix) directly in the WP Admin -> KadiCache -> Object Cache form (ObjectCacheConfig.php), or pin them via immutable constants in wp-config.php for multi-environment Git deployments:

PHPOptional Immutable Object Cache Constants in wp-config.php
// Pin Redis/Valkey Unix socket or TCP host in wp-config.php (above wp-settings.php)
define('KADICACHE_OBJECT_CACHE_DRIVER', 'phpredis'); // auto|relay|phpredis|memcached|apcu|sqlite|file
define('KADICACHE_REDIS_HOST', '127.0.0.1');         // or '/var/run/redis/redis.sock'
define('KADICACHE_REDIS_PORT', 6379);                // 0 when using a Unix domain socket
define('KADICACHE_REDIS_DATABASE', 0);               // Isolate staging vs live on same Redis
// define('KADICACHE_REDIS_PASSWORD', 'your-strong-redis-secret');

Free Pro-Grade Accelerators: Prefetch, Split alloptions & AutoloadAnalyzer#

Features that other vendors lock behind $99+/month Object Cache add-ons are included 100% free in KadiCache Core:

  1. Smart Route Prefetching (MAX_PREFETCH_KEYS = 200): Instead of firing 180 sequential GET network calls during a WooCommerce page render, KadiCache learns the hot object keys used on each route template and prefetches up to 200 keys in one single MGET round-trip at the start of the request—populating L1 PHP memory before plugins run!
  2. Atomic Split alloptions: WordPress core normally bundles every autoloaded option into one monolithic alloptions blob, causing race conditions (WordPress Trac #31245) when two concurrent requests update different options. Enabling Atomic Split Alloptions stores options cleanly so concurrent WooCommerce orders never overwrite newly saved settings.
  3. Compact Binary Serialization & Compression (ObjectCacheSerializer.php): Automatically uses igbinary + zstd, lz4, or zlib when available, cutting Redis RAM usage by 55% to 75%.
  4. Built-In AutoloadAnalyzer.php: Inspect total autoloaded wp_options byte weight and identify the heaviest orphaned plugin option rows directly inside WP Admin -> KadiCache -> Object Cache or via wp kadicache object-cache info!
BASHComplete WP-CLI Object Cache Lifecycle Commands (ObjectCacheCli.php)
# 1. Probe backend latency & inspect top bloated autoloaded wp_options rows
wp kadicache object-cache info --format=table

# 2. Enable wp-content/object-cache.php (add --force-takeover to back up & replace an old drop-in)
wp kadicache object-cache enable --driver=auto

# 3. Inspect live hit_ratio, active driver, serializer, compression & split_alloptions
wp kadicache object-cache status --format=table

# 4. O(1) Epoch flush (or --blog=2 on Multisite) & safe disable
wp kadicache object-cache flush
wp kadicache object-cache disable

Cleaning Up Bloated wp_options Discovered by AutoloadAnalyzer#

When wp kadicache object-cache info or the WP Admin -> KadiCache -> Object Cache panel highlights total autoloaded wp_options exceeding 800 KB – 1 MB, follow this safe remediation sequence:

  1. Purge Expired Transients & Action Scheduler Bloat First: Visit WP Admin -> KadiCache -> Database (Bloat Removal & Database Cleanup) and run Safe Quick Clean—badly coded legacy plugins frequently store expired transients without an expiration timestamp, leaving megabytes stranded in wp_options.
  2. Identify Deactivated Plugin Prefixes: Look at the top 15 largest option_name rows reported by AutoloadAnalyzer.php. Options starting with prefixes of plugins you uninstalled months ago (such as old slider backups, retired SEO redirect logs, or theme demo import arrays) can be set to autoload = 'off' via wp option set-autoload <option_name> no after taking a database backup.
  3. Flush Object Cache Once (wp kadicache object-cache flush): Verify that total autoloaded memory drops immediately and uncached wp-admin TTFB improves.

Frequently Asked Operational Questions

Does KadiCache Object Cache work with Valkey and KeyDB as well as Redis?
Yes! Valkey, KeyDB, Dragonfly, and AWS ElastiCache speak the standard RESP protocol and work smoothly with RelayDriver, PhpRedisDriver, and PhpStreamRedisDriver.
What if my cPanel or shared host runs Redis locally, but PHP does not have the phpredis extension installed?
KadiCache includes PhpStreamRedisDriver—a pure-PHP RESP socket client that connects to TCP or Unix-socket Redis instances with zero C extensions required.
Should I use SQLite WAL Object Cache on shared hosting that has no Redis or APCu?
Yes, when your shared host uses local SSD/NVMe storage and remote TCP MySQL servers. SQLite WAL serves local indexed reads faster than opening network queries to a congested shared MySQL host, while automatically pruning expired transients.
Can two separate WordPress installs share the same Redis server safely?
Yes. Assign either a distinct Redis database index (0–15, e.g., KADICACHE_REDIS_DATABASE = 1 for staging) or unique key prefixes inside WP Admin -> KadiCache -> Object Cache so keys never collide.
Why does KadiCache flush Object Cache via an O(1) Epoch bump instead of Redis FLUSHALL?
Running FLUSHALL blocks the single-threaded Redis event loop on large datasets and wipes sibling databases/sites on the same Redis daemon. Incrementing KadiCache’s namespace epoch invalidates stale entries in under 0.1 ms with zero blocking!
Gergis — Lead Systems & Cache Architect
Principal WordPress & Cloud Edge Architect
E-E-A-T Source Verified

Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.

apps/wordpress-plugin/src/Cache/ObjectCache/ObjectCacheEngine.phpapps/wordpress-plugin/src/Cache/ObjectCache/ObjectCacheDropinManager.phpapps/wordpress-plugin/src/Cache/ObjectCache/AutoloadAnalyzer.phpapps/wordpress-plugin/src/Cli/ObjectCacheCli.php
Was this engineering guide helpful?