Constants Reference

This is a complete reference of all configuration constants available in MilliCache. Define these in wp-config.php before the line "That's all, stop editing!". Alternatively, use the admin UI (Settings -> MilliCache) or WP-CLI to manage settings stored in the database.

Required Constants#Copied!

WP_CACHE#Copied!

 1define( 'WP_CACHE', true );

Required. Enables WordPress drop-in caching. Without this, MilliCache cannot intercept requests early.

Storage Constants#Copied!

Connection settings for your Redis-compatible server.

MC_STORAGE_HOST#Copied!

 1define( 'MC_STORAGE_HOST', '127.0.0.1' );
Property Value
Default 127.0.0.1
Type string

Server hostname, IP address, or Unix socket path.

Examples:

 1// IP address
 2define( 'MC_STORAGE_HOST', '10.0.0.5' );
 3
 4// Hostname
 5define( 'MC_STORAGE_HOST', 'redis.example.com' );
 6
 7// Docker container name
 8define( 'MC_STORAGE_HOST', 'redis' );
 9
10// Unix socket
11define( 'MC_STORAGE_HOST', '/var/run/redis/redis.sock' );

MC_STORAGE_PORT#Copied!

 1define( 'MC_STORAGE_PORT', 6379 );
Property Value
Default 6379
Type integer

TCP port number. Ignored when using Unix sockets.

MC_STORAGE_PASSWORD#Copied!

 1define( 'MC_STORAGE_PASSWORD', 'your-password' );
Property Value
Default '' (empty)
Type string

Redis AUTH password. Leave empty if no authentication required.

Note: When using the admin UI or WP-CLI, the password is stored encrypted as enc_password.

MC_STORAGE_DB#Copied!

 1define( 'MC_STORAGE_DB', 0 );
Property Value
Default 0
Type integer

Redis database number (0-15). Use different databases to isolate cache data.

MC_STORAGE_PERSISTENT#Copied!

 1define( 'MC_STORAGE_PERSISTENT', true );
Property Value
Default true
Type boolean

Enable persistent connections. Reduces connection overhead but requires proper server configuration.

MC_STORAGE_PREFIX#Copied!

 1define( 'MC_STORAGE_PREFIX', 'mll' );
Property Value
Default mll
Type string

Prefix for all cache keys in Redis. Use different prefixes to share Redis between sites.

Cache Constants#Copied!

Settings that control caching behavior.

MC_CACHE_TTL#Copied!

 1define( 'MC_CACHE_TTL', 86400 );
Property Value
Default 86400 (1 day)
Type integer

Time-to-live in seconds. How long cached content remains fresh.

Value Duration
3600 1 hour
86400 1 day
604800 1 week
2592000 30 days

MC_CACHE_GRACE#Copied!

 1define( 'MC_CACHE_GRACE', 2592000 );
Property Value
Default 2592000 (30 days)
Type integer

Grace period in seconds. How long stale content can be served while regenerating.

MC_CACHE_DEBUG#Copied!

 1define( 'MC_CACHE_DEBUG', false );
Property Value
Default false
Type boolean

Enable debug response headers. Useful for troubleshooting, disable in production.

MC_CACHE_GZIP#Copied!

 1define( 'MC_CACHE_GZIP', true );
Property Value
Default true
Type boolean

Enable gzip compression of cached content. Requires ext-zlib.

MC_CACHE_UNIQUE#Copied!

 1define( 'MC_CACHE_UNIQUE', [] );
Property Value
Default []
Type array

Variables that make cache entries unique. Each combination creates a separate entry.

 1define( 'MC_CACHE_UNIQUE', [ 'device', 'currency' ] );
Warning: Overuse can lead to cache fragmentation and reduced hit rates. Use with caution.

MC_CACHE_NOCACHE_PATHS#Copied!

 1define( 'MC_CACHE_NOCACHE_PATHS', [] );
Property Value
Default []
Type array

URL paths to exclude from caching. Supports wildcards.

 1define( 'MC_CACHE_NOCACHE_PATHS', [
 2    '/my-account/*',
 3    '/checkout/*',
 4    '/cart/*',
 5] );

MC_CACHE_NOCACHE_COOKIES#Copied!

 1define( 'MC_CACHE_NOCACHE_COOKIES', [ 'wp-*pass*', 'comment_author_*' ] );
Property Value
Default ['wp-*pass*', 'comment_author_*']
Type array

Cookies that cause cache bypass. Supports wildcards.

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

MC_CACHE_IGNORE_COOKIES#Copied!

 1define( 'MC_CACHE_IGNORE_COOKIES', [ '_*' ] );
Property Value
Default ['_*']
Type array

Cookies stripped from cache key calculation. Supports wildcards.

 1define( 'MC_CACHE_IGNORE_COOKIES', [
 2    '_*',       // Analytics
 3    '__utm*',   // UTM tracking
 4] );

MC_CACHE_IGNORE_REQUEST_KEYS#Copied!

 1define( 'MC_CACHE_IGNORE_REQUEST_KEYS', [ '_*', 'utm_*' ] );
Property Value
Default ['_*', 'utm_*']
Type array

Query parameters stripped from cache key. Supports wildcards.

 1define( 'MC_CACHE_IGNORE_REQUEST_KEYS', [
 2    '_*',
 3    'utm_*',
 4    'fbclid',
 5    'gclid',
 6] );

WordPress Cache Constants#Copied!

Standard WordPress constants that affect MilliCache behavior.

DONOTCACHEPAGE#Copied!

 1define( 'DONOTCACHEPAGE', true );

Set dynamically in themes/plugins to skip caching for the current request.

 1// In your template
 2if ( some_condition() ) {
 3    define( 'DONOTCACHEPAGE', true );
 4}

DOING_CRON#Copied!

 1define( 'DOING_CRON', true );

Automatically set by WordPress during cron execution. MilliCache skips caching.

DOING_AJAX#Copied!

 1define( 'DOING_AJAX', true );

Automatically set by WordPress during AJAX requests. MilliCache skips caching.

REST_REQUEST#Copied!

 1define( 'REST_REQUEST', true );

Automatically set by WordPress during REST API requests. MilliCache skips caching.

Complete Configuration Example#Copied!

 1<?php
 2// wp-config.php
 3
 4// Enable caching (REQUIRED)
 5define( 'WP_CACHE', true );
 6
 7// Storage settings
 8define( 'MC_STORAGE_HOST', 'redis.example.com' );
 9define( 'MC_STORAGE_PORT', 6379 );
10define( 'MC_STORAGE_PASSWORD', 'secure-password' );
11define( 'MC_STORAGE_DB', 0 );
12define( 'MC_STORAGE_PERSISTENT', true );
13define( 'MC_STORAGE_PREFIX', 'mll_prod' );
14
15// Cache settings
16define( 'MC_CACHE_TTL', 86400 );        // 1 day
17define( 'MC_CACHE_GRACE', 2592000 );    // 30 days
18define( 'MC_CACHE_DEBUG', false );
19define( 'MC_CACHE_GZIP', true );
20
21// Exclusions
22define( 'MC_CACHE_NOCACHE_PATHS', [
23    '/my-account/*',
24    '/checkout/*',
25    '/cart/*',
26] );
27
28define( 'MC_CACHE_NOCACHE_COOKIES', [
29    'wp-*pass*',
30    'comment_author_*',
31] );
32
33define( 'MC_CACHE_IGNORE_COOKIES', [
34    '_*',
35    '__utm*',
36] );
37
38define( 'MC_CACHE_IGNORE_REQUEST_KEYS', [
39    '_*',
40    'utm_*',
41    'fbclid',
42    'gclid',
43] );
44
45/* That's all, stop editing! */

Next Steps#Copied!