MilliCache: The WordPress Cache That Treats Invalidation Like a Database Problem
A look at how a pre-boot PHP hook, Redis-class memory stores, and flag-based rules turn WordPress page caching into a precise control system instead of a blunt purge machine.
- MilliCache reframes WordPress performance as an invalidation problem, not just a storage problem.
- Its flags and rules model lets a single content change affect every related cached view without wiping the whole system.
- The advanced-cache.php drop-in matters because it lets the plugin act before WordPress core turns the request into expensive work.
- The project feels more like infrastructure than a plugin because it pairs Redis-class storage with testable orchestration and WordPress-aware deployment hygiene.
WordPress Caching, But With Actual Selectivity
Most WordPress caches are fast until they are wrong. Then they become a cleanup problem, and cleanup is where simple systems get expensive. MilliCache starts from a different premise: cache entries should carry labels, and invalidation should target those labels instead of guessing at URLs.
That is why the project feels more systems-like than most caching plugins. It is not just serving HTML from memory. It is building a model of what a page depends on, then using that model to clear only what changed.
| Backend | Cache unit | Invalidation model | Typical scale target | Strength | Limitation |
|---|---|---|---|---|---|
| File cache | Static HTML file | URL-level purge | Small to mid sites | Simple and familiar | Hard to keep precise at scale |
| Redis-style page cache | Stored response | Key or URL purge | Traffic-heavy sites | Fast lookups in memory | Can still be blunt about dependencies |
| MilliCache | Labeled cache entry | Flag-based selective invalidation | High-traffic, multi-site, shared-cache setups | Targets related pages without clearing everything | More moving parts than a basic file cache |
The Pre-Boot Trapdoor
MilliCache’s most important execution detail is not glamorous: advanced-cache.php. WordPress loads that drop-in before the theme, before most plugins, and before the database-heavy parts of the request. That gives MilliCache a chance to answer with cached HTML and exit early.
The practical result is straightforward. The plugin can skip the cost of a normal WordPress bootstrap on a cache hit. The strategic result is bigger: the cache is not an afterthought bolted onto WordPress, it is a first responder inserted into the request path.
<?php
// advanced-cache.php
if (file_exists(__DIR__ . '/src/Engine.php')) {
require_once __DIR__ . '/src/Engine.php';
\MilliCache\Engine::instance()->start();
}
How the Engine Orchestrates the Request
Under the hood, Engine acts like a conductor. It wires together storage, request processing, and response processing, then keeps the hot path compact so the request can stay fast. The interesting part is not that the system is modular. The interesting part is that the hot path stays slim because the surrounding pieces are separated cleanly.
That separation matters in WordPress, where global state and side effects can make even simple behavior hard to reason about. A Loader class centralizes hook registration, which makes the plugin easier to test and easier to audit. You can see the design bias clearly: fewer scattered hooks, more controlled orchestration.
final class Engine {
private static ?self $instance = null;
public static function instance(): self {
return self::$instance ??= new self();
}
public function start(): void {
// Boot storage, request processor, response processor.
}
}
Flags, Rules, and the Difference Between Purging and Understanding
This is the center of the project. MilliCache tags cached responses with flags such as post relationships, archive relationships, and custom labels. When content changes, it invalidates by label, not by guesswork. That turns a content update into a dependency event.
That distinction changes the whole mental model. A blunt cache says, "this URL is stale." MilliCache asks, "which cached responses depend on this fact?" That is why the system feels closer to dependency management than to cache flushing.
The rule engine pushes that idea further. Instead of burying behavior in nested conditionals, millirules lets caching logic be expressed declaratively. In other words, the system can decide what to cache, when to cache it, and when to clear it without turning the codebase into a maze of one-off exceptions.
What the Storage Layer Is Buying You
MilliCache wraps a Redis-compatible storage layer, and that choice is not just about speed. It supports TCP, TLS, and Unix socket connections, which means the same abstraction can work in local, secured, and shared deployment setups. It is doing infrastructure work, not just convenience work.
There is also a practical security story here. Credentials can be handled with encrypted settings, and persistent connections reduce repeated handshake overhead. The plugin is clearly designed for environments where cache misses are not the only thing you want to avoid.
MilliCache stores complete HTML pages in memory and serves them in milliseconds — without loading WordPress.
That README line is doing a lot of work, and it is accurate about the architectural bet. Millisecond responses are not magic. They are the result of getting the request out of the WordPress runtime as early as possible, then backing that shortcut with a cache store that can actually absorb the traffic.
Why This Plugin Feels More Like Infrastructure Than a Plugin
The codebase looks disciplined in the ways that matter for a WordPress system expected to live in real deployments. Strict typing, tests, WP-CLI support, and dependency prefixing all point in the same direction: survive the chaos of WordPress without becoming chaotic yourself.
The Strauss prefixing choice is a good example. It prevents dependency collisions in a universe where other plugins may ship their own libraries. That sounds mundane until you remember how often WordPress sites become a stack of mutually suspicious packages. MilliCache is built to coexist, not just to work in isolation.
| Project trait | What it suggests | Why it matters |
|---|---|---|
| Strict typing and static analysis | The code is meant to be reasoned about | Fewer hidden edge cases in the hot path |
| WP-CLI integration | Operations are part of the product | Admins can inspect and manage cache behavior without the UI |
| Dependency prefixing | The plugin expects a crowded ecosystem | Reduces collision risk with other WordPress extensions |
| Test stack | Behavior is meant to be verified | Safer changes in a performance-sensitive system |
How MilliCache Differs From the Old Guard
Older caching tools solved real problems, and they still matter. But they mostly optimize the storage location of the cached page. MilliCache is trying to optimize the intelligence around the cache entry itself.
| Project | Cache unit | Invalidation model | Typical scale target | Strength | Limitation |
|---|---|---|---|---|---|
| Page Cache Red | Redis-backed page response | Key or page purge | Fast single-host setups | Simple and quick to deploy | Less explicit about dependency structure |
| Cachify | Static post or page output | Storage-layer purge | Smaller sites and simple deployments | Flexible storage choices | Not built around selective cache intelligence |
| Cache Enabler | Static HTML file | File invalidation | Lightweight sites | Easy disk-based caching | Limited precision for complex dependency graphs |
| MilliCache | Labeled cache entry | Flag-based targeted invalidation | Shared-cache and high-traffic WordPress | Controls what changes ripple through the cache | Requires more operational thought |
What This Says About Modern WordPress Performance
MilliCache is a sign that WordPress performance work is becoming more like systems design. The interesting questions are no longer just "How do I cache this page?" They are "When should this cache exist? What does it depend on? What should disappear when the content changes?"
That shift favors teams running high-traffic sites, multisite networks, and shared infrastructure. If you are operating at that level, blunt purge behavior is not a feature. It is debt. MilliCache is interesting because it treats that debt as the real problem and builds the cache around answering it.





