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.
- Ships 7 production backends (
ObjectCacheEngine.php) in 100% Free Core:RelayDriver,PhpRedisDriver,PhpStreamRedisDriver(zero PHP extension needed!),MemcachedDriver,ApcuDriver,SqliteDriver(WAL), andFileObjectDriver. - Includes Smart Route Prefetching (
200keys in1MGETround-trip), Atomic Splitalloptions(fixing WordPress#31245race conditions), andigbinary+zstd/zlib/lz4compression at$0. - Audits bloated
autoload = yes/onrows inwp_optionsviaAutoloadAnalyzer.phpdirectly inside the Object Cache tab andwp kadicache object-cache info. - Protects site uptime with a
5-second automatic circuit-breaker so a restarted Redis or Memcached daemon never takes downwp-adminor WooCommerce checkout.
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:
- Logged-In
WP Admin, Gutenberg Editing & Order Management: Every admin screen runs60 to 180SQL queries for capabilities, options, menus, and WooCommerce analytics. - Dynamic WooCommerce Cart, Checkout & My Account Flows: Active checkout calculations, shipping rate lookups, tax queries, and coupon validations execute live PHP on every step.
- REST API,
admin-ajax.php, WP-Cron & Action Scheduler Workers: Background webhooks and subscription renewals hammer MySQL continuously. - 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 Storage | Best Hosting Environment | Standout Advantage |
|---|---|---|---|
relay | CacheWerk Relay C extension + Redis/Valkey | High-traffic single/multi-node VPS & Enterprise | Shared in-process C memory + Redis invalidation (~0.05 ms reads) |
phpredis | Native ext-redis C extension (TCP / TLS / Unix socket) | Cloudways, VPS, Kubernetes, AWS ElastiCache, Valkey | Fastest standard network driver; native MGET & igbinary/zstd |
redis-socket / Stream | PhpStreamRedisDriver (pure PHP RESP socket) | cPanel / Plesk hosts running Redis without ext-redis | Connects to Redis/Valkey over TCP or /var/run/redis/redis.sock with 0 extensions |
memcached | ext-memcached binary protocol | SiteGround-style or legacy multi-web Memcached pools | Multi-get batching (getMulti) across distributed Memcached nodes |
apcu | ext-apcu shared PHP-FPM worker RAM | Single-server NVMe VPS without Redis installed | Zero socket serialization overhead (~0.02 ms in-RAM reads) |
sqlite | PDO_SQLite / SQLite3 in WAL mode | Shared hosting without Redis, Memcached, or APCu | Concurrent WAL reads on local NVMe faster than remote MySQL sockets |
file | Sharded atomic disk store (FileObjectDriver) | Universal fallback environment | Atomic lock-safe persistence anywhere PHP can write files |
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:
// 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:
- Smart Route Prefetching (
MAX_PREFETCH_KEYS = 200): Instead of firing 180 sequentialGETnetwork calls during a WooCommerce page render, KadiCache learns the hot object keys used on each route template and prefetches up to200keys in one singleMGETround-trip at the start of the request—populating L1 PHP memory before plugins run! - Atomic Split
alloptions: WordPress core normally bundles every autoloaded option into one monolithicalloptionsblob, 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. - Compact Binary Serialization & Compression (
ObjectCacheSerializer.php): Automatically usesigbinary+zstd,lz4, orzlibwhen available, cutting Redis RAM usage by55% to 75%. - Built-In
AutoloadAnalyzer.php: Inspect total autoloadedwp_optionsbyte weight and identify the heaviest orphaned plugin option rows directly insideWP Admin -> KadiCache -> Object Cacheor viawp kadicache object-cache info!
# 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 disableCleaning 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:
- 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 inwp_options. - Identify Deactivated Plugin Prefixes: Look at the top 15 largest
option_namerows reported byAutoloadAnalyzer.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 toautoload = 'off'viawp option set-autoload <option_name> noafter taking a database backup. - Flush Object Cache Once (
wp kadicache object-cache flush): Verify that total autoloaded memory drops immediately and uncachedwp-adminTTFB improves.
Frequently Asked Operational Questions
Does KadiCache Object Cache work with Valkey and KeyDB as well as Redis?
What if my cPanel or shared host runs Redis locally, but PHP does not have the phpredis extension installed?
Should I use SQLite WAL Object Cache on shared hosting that has no Redis or APCu?
Can two separate WordPress installs share the same Redis server safely?
Why does KadiCache flush Object Cache via an O(1) Epoch bump instead of Redis FLUSHALL?
Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.