- Ships 7 native storage backends (
RelayDriver,PhpRedisDriver,PhpStreamRedisDriver,MemcachedDriver,ApcuDriver,SqliteDriver,FileObjectDriver) with automatic capability detection. - Learns up to
200hot keys per route (MAX_PREFETCH_KEYS = 200) and warms L1 request memory in a singleMGETround-trip before plugins execute. - Eliminates the infamous WordPress
#31245alloptionsrace condition viasplit_alloptionsindividual hash fields and hybrid APCu L1 verification. - Fails open in
5seconds (CIRCUIT_COOLDOWN_SECONDS = 5) if Redis or Memcached restarts, keepingwp-adminand WooCommerce checkout online.
Table of Contents (5 sections)
- Where Page Caching Stops, Persistent Object Caching Takes Over
- 7 Native Storage Drivers: From C-Level Relay Down to Shared-Hosting SQLite WAL
- 1-RTT Smart Route Prefetching (MAX_PREFETCH_KEYS = 200)
- Atomic split_alloptions Shield, O(1) Epoch Flushes & 5-Second Circuit Breaker
- Atomic Drop-In Management & WP-CLI Operations
Where Page Caching Stops, Persistent Object Caching Takes Over#
Full-page HTML caching makes anonymous storefront browsing instantaneous, yet 30% to 45% of real WordPress CPU time happens on requests that intentionally bypass full-page cache: wp-admin product editing, WooCommerce cart and checkout submissions, REST API calls, admin-ajax.php endpoints, logged-in membership dashboards, Action Scheduler background ticks, and uncached page rebuilds.
Without a persistent wp-content/object-cache.php drop-in, WordPress's default WP_Object_Cache discards every cached option, term relationship, post meta lookup, and transient the millisecond the PHP request finishes. Even with a basic third-party Redis drop-in installed, two architectural bottlenecks routinely degrade busy WooCommerce stores:
- The "Death by 400 Sequential
GETCalls" Problem: A single WooCommerce checkout orwp-admin/edit.php?post_type=productload often triggers 350 to 700 individualwp_cache_get()calls. Even when Redis responds in0.25 msper TCP call, 500 sequential synchronous round-trips burn 125 ms of pure network socket wait time. - The WordPress Core
#31245alloptionsRace Condition: Standard object cache drop-ins serialize every autoloadedwp_optionsrow into one giant monolithic blob (options:alloptions). Under concurrent traffic, if Request A updates a WooCommerce transient while Request B updates a cron lock, one worker overwrites the other's serialized blob—causing mysterious lost settings, stuck cron jobs, and multi-megabyte network transfers on every single request.
ObjectCacheEngine.php was engineered from scratch to eliminate both bottlenecks across dedicated VPS clusters and restricted shared hosting alike—included 100% free in KadiCache Core.
7 Native Storage Drivers: From C-Level Relay Down to Shared-Hosting SQLite WAL#
Most WordPress object cache plugins hard-require phpredis and leave shared-hosting or container environments without C extensions stranded. ObjectCacheEngine implements a unified ObjectCacheBackendInterface backed by 7 purpose-built drivers under Cache/ObjectCache/Drivers/:
| Driver Class | Underlying Engine | Best Deployment Scenario | Key Engineering Advantage |
|---|---|---|---|
RelayDriver | CacheWerk Relay (C-ext) | High-concurrency NVMe / Redis / Valkey VPS | Shared in-PHP C memory + client-side invalidation with near-zero socket I/O |
PhpRedisDriver | ext-redis (TCP / TLS / Unix Socket) | Managed Cloudways, RunCloud, GridPane, AWS ElastiCache | Native C pipelining, Redis 6+ ACL auth, Redis Cluster {kc:prefix} hash tags & UNLINK |
PhpStreamRedisDriver | Pure PHP RESP Stream | Docker / cPanel hosts with Redis daemon but no ext-redis | Connects over TCP or Unix domain sockets without requiring a compiled PHP C extension |
MemcachedDriver | ext-memcached | SiteGround / multi-node Memcached pools | Binary protocol multi-get (getMulti) and SASL authentication |
ApcuDriver | ext-apcu Shared RAM | Single-node LiteSpeed / Nginx / Apache servers | Sub-microsecond shared memory reads inside PHP-FPM with zero daemon overhead |
SqliteDriver | PDO_SQLite / SQLite3 (WAL) | Shared hosting without Redis, Memcached, or APCu | Concurrent PRAGMA journal_mode=WAL persistent object store on local NVMe disk |
FileObjectDriver | Sharded Local Filesystem | Universal fallback on locked-down PHP 7.4+ hosts | Atomic sharded binary files with OPcache-friendly config loading |
When you leave Storage Backend Driver set to Auto-Detect Best Available, ObjectCacheConfig probes installed extensions and live daemons in priority order so your site automatically uses the fastest healthy backend available.
1-RTT Smart Route Prefetching (MAX_PREFETCH_KEYS = 200)#
Instead of fetching keys one by one as WordPress hooks fire, ObjectCacheEngine fingerprints the current route ($this->resolveRouteId()) as soon as wp_start_object_cache() boots (and re-warms cleanly on switchToBlog() in early Multisite routing).
Atomic split_alloptions Shield, O(1) Epoch Flushes & 5-Second Circuit Breaker#
Three additional safeguards inside ObjectCacheEngine.php protect production WooCommerce stores under heavy write load:
- Atomic Split Alloptions (
split_alloptions): Instead of storingoptions:alloptionsas a single fragile serialized string,getAllOptions()stores autoloaded options as individual hash fields and tracks baseline diffs per key. Concurrent updates to two different WordPress options never overwrite one another, and when Hybrid APCu L1 Hot-Options Turbo is enabled alongside Redis or SQLite, revision-verifiedalloptionsreads resolve from local shared RAM without touching the socket. - Smart Binary Serialization & Compression (
ObjectCacheSerializer.php): Automatically negotiatesigbinary(falling back cleanly to taggedphpserialization) and compresses payloads >= 256 bytes using the fastest installed codec (zstd -> lz4 -> lzf -> zlib) while keeping small integer counters uncompressed. - Non-Blocking
O(1)Epoch Invalidation & Subsite Flushes: Callingwp_cache_flush()orwp kadicache object-cache flush --blog=3increments a lightweight epoch counter ($this->epochs) and uses asynchronousUNLINKrather than blocking Redis's single-threaded event loop withFLUSHALLorKEYS *scans. On WordPress Multisite, flushing Blog #3 leaves Blog #1 and Blog #2 completely warm. - 5-Second Circuit Breaker (
CIRCUIT_COOLDOWN_SECONDS = 5): If a Redis container restarts or a network socket times out,ObjectCacheEnginewrites a lightweight local cooldown marker insys_get_temp_dir()for 5 seconds and falls back immediately to in-memory$this->l1execution instead of hanging every PHP worker on connection timeouts.
Atomic Drop-In Management & WP-CLI Operations#
Enabling Object Cache inside WP Admin -> KadiCache -> Object Cache runs a live pre-flight read/write probe (ObjectCacheEngine::probeConnection()) before ObjectCacheDropinManager writes wp-content/object-cache.php and OPcache-accelerated object-cache-config.php (with connection passwords excluded from JSON settings exports). You can manage every aspect from WP-CLI:
# Check drop-in ownership, active driver, serializer, compressor & hit ratio
wp kadicache object-cache status
# Probe backend latency (ms) and list top autoloaded wp_options offenders
wp kadicache object-cache info
# Enable with auto-detection or pin a specific driver (relay, phpredis, apcu, sqlite...)
wp kadicache object-cache enable --driver=auto
# Flush all entries in O(1) time, or flush a single Multisite blog ID
wp kadicache object-cache flush
wp kadicache object-cache flush --blog=2Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.