Configuration Overview

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

Quick Start#

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#

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#

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

Using Admin UI#

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#

 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#

Storage Settings#

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_PASSWORD '' Redis AUTH password
MC_STORAGE_DB 0 Database number (0-15)
MC_STORAGE_PREFIX mll Key prefix

Cache Settings#

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#

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

Common Configurations#

High-Traffic Site#

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

Frequently Updated Content#

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

Development Environment#

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

WooCommerce Site#

 1define( 'MC_CACHE_NOCACHE_COOKIES', [
 2    'wp-*pass*',
 3    'comment_author_*',
 4    'woocommerce_*',
 5    'sbjs_*'
 6] );

Viewing Current Configuration#

 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#