Configuration Overview

MilliCache can be configured through multiple sources. This guide covers the basics — see the Reference for all available constants.

Quick Start#Copied!

Add this to your wp-config.php before "That's all, stop editing!":

 1// Required - enables WordPress caching
 2define( 'WP_CACHE', true );
 3
 4// Optional - Connect to Redis (adjust for your setup)
 5define( 'MC_STORAGE_HOST', '127.0.0.1' );
 6define( 'MC_STORAGE_PORT', 6379 );

That's it! MilliCache will use the defaults for everything else.

Configuration Sources#Copied!

Settings are resolved in priority order:

Priority Source Best For
1 (highest) Constants in wp-config.php Production, version control
2 Database (Admin UI, WP-CLI) Easy management
3 Defaults Fallback values

Higher-priority sources always win. A constant overrides the database value.

Using Constants#Copied!

Define in wp-config.php with the format MC_<MODULE>_<KEY>:

 1define( 'MC_CACHE_TTL', 86400 );       // 1 day
 2define( 'MC_CACHE_DEBUG', true );      // Debug headers
 3define( 'MC_STORAGE_HOST', 'redis' );  // Redis hostname

Defining a constant sets the value and locks it in the admin UI; removing the constant unlocks the setting but keeps its last value. Changing a constant behaves exactly like changing the setting in the admin UI: any side effects (such as rescheduling background jobs) are applied automatically on the next admin visit.

Using Admin UI#Copied!

Navigate to Settings → MilliCache to configure via the WordPress admin.

Note: Settings defined via constants are shown but cannot be modified in the admin UI.

Using WP-CLI#Copied!

 1# View all settings
 2wp millicache config get
 3
 4# Set a value
 5wp millicache config set cache.ttl 86400
 6
 7# See where values come from
 8wp millicache config get --show-source

Setting Categories#Copied!

Storage Settings#Copied!

Connection to your Redis-compatible server:

Constant Default Description
MC_STORAGE_HOST 127.0.0.1 Hostname, IP, socket, or tls://host
MC_STORAGE_PORT 6379 TCP port
MC_STORAGE_USERNAME '' Redis ACL username
MC_STORAGE_PASSWORD '' Redis AUTH password
MC_STORAGE_DB 0 Database number (0-15)
MC_STORAGE_PREFIX mll Key prefix

Cache Settings#Copied!

Caching behavior:

Constant Default Description
MC_CACHE_TTL 86400 Time-to-live (1 day)
MC_CACHE_GRACE 2592000 Grace period (30 days)
MC_CACHE_DEBUG false Debug headers
MC_CACHE_GZIP true Compression

Exclusion Settings#Copied!

What to skip:

Constant Default Description
MC_CACHE_NOCACHE_PATHS [] URL paths to exclude
MC_CACHE_NOCACHE_COOKIES [...] Cookies that bypass cache
MC_CACHE_IGNORE_COOKIES ['_*'] Cookies stripped from key
MC_CACHE_IGNORE_REQUEST_KEYS ['_*', 'utm_*'] Query params to ignore

Key Composition Settings#Copied!

How cache entries differentiate from each other:

Constant Default Description
MC_CACHE_UNIQUE [] Static deployment-level keys folded into every request hash
MC_CACHE_BUCKETS [] Per-request signal → token map (Accept negotiation, language, device, …)

Update Settings#Copied!

Plugin update behavior:

Constant Default Description
MC_UPDATE_PRERELEASE false Opt in to prerelease (beta) builds

Update checks can be disabled with the millicache_updates filter. See the Constants Reference and Hooks & Filters for details.

Common Configurations#Copied!

High-Traffic Site#Copied!

 1define( 'MC_CACHE_TTL', 604800 );     // 7 days
 2define( 'MC_CACHE_GRACE', 2592000 );  // 30 days grace
 3define( 'MC_CACHE_GZIP', true );

Frequently Updated Content#Copied!

 1define( 'MC_CACHE_TTL', 3600 );       // 1 hour
 2define( 'MC_CACHE_GRACE', 86400 );    // 1 day grace

Development Environment#Copied!

 1define( 'MC_CACHE_TTL', 60 );         // 1 minute
 2define( 'MC_CACHE_DEBUG', true );     // Show debug headers

WooCommerce Site#Copied!

WooCommerce already marks its dynamic pages (cart, checkout, my account) with the DONOTCACHEPAGE constant, which MilliCache respects out of the box. What you should configure is cookie handling: WooCommerce sets several cookies for ordinary browsing visitors, and any cookie MilliCache does not ignore becomes part of the cache key.

 1define( 'MC_CACHE_IGNORE_COOKIES', [
 2    '_*',                        // Keep the default (analytics cookies)
 3    'sbjs_*',                    // Order Attribution tracking (every visitor)
 4    'woocommerce_*',             // Recently viewed, cart hash, items in cart
 5    'wp_woocommerce_session_*',  // Customer session
 6    'store_notice*',             // Dismissed store notices
 7] );

Do not add woocommerce_* or sbjs_* to MC_CACHE_NOCACHE_COOKIES. Cookies like woocommerce_recently_viewed are set the moment a visitor views a product, so a bypass on them silently turns most browsing traffic into cache misses. See the FAQ for the full explanation.

Viewing Current Configuration#Copied!

 1# All settings with sources
 2wp millicache config get --show-source
 3
 4# Test connection
 5wp millicache test
 6
 7# Cache statistics
 8wp millicache stats

Next Steps#Copied!

Last updated:

Release updates

Get notified when new versions and guides ship. No spam.

By subscribing you agree to our Privacy Policy.­ Double opt-in, no spam, unsubscribe anytime.