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 or array

Server hostname, IP address, or Unix socket path. Supports an optional tls:// or tcp:// scheme prefix for encrypted connections.

Set it to an array to enable replication (a master key) or Sentinel (a service key). See High Availability for the syntax.

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' );
12
13// TLS connection (e.g. AWS ElastiCache with in-transit encryption)
14define( 'MC_STORAGE_HOST', 'tls://master.example.cache.amazonaws.com' );

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_USERNAME#Copied!

 1define( 'MC_STORAGE_USERNAME', 'your-username' );
Property Value
Default '' (empty)
Type string

Redis ACL username. Leave empty to use the default user. Required when your Redis server is configured with ACL users (Redis 6+).

Note: When using the admin UI or WP-CLI, the setting key is storage.username.

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_TIMEOUT#Copied!

 1define( 'MC_STORAGE_TIMEOUT', 1.0 );
Property Value
Default 1.0
Type float (seconds)

Connection timeout in seconds. The low default lets an unreachable backend fall back to uncached WordPress quickly. Raise it only if your server is healthy but distant.

MC_STORAGE_READ_TIMEOUT#Copied!

 1define( 'MC_STORAGE_READ_TIMEOUT', 2.0 );
Property Value
Default 2.0
Type float (seconds)

Read/write timeout in seconds. Raise it only if you serve very large cached responses over a slow link.

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

Static cache namespace: values folded into every request hash on this deployment. Use for deploy-time cache busting or multi-site isolation.

 1define( 'MC_CACHE_UNIQUE', [ 'version' => '2.1', 'site_id' => 5 ] );
Tip: For per-request differentiation, use MC_CACHE_BUCKETS instead.

MC_CACHE_BUCKETS#Copied!

 1define( 'MC_CACHE_BUCKETS', [] );
Property Value
Default []
Type array<string, array<string, string>>

Shared lookup tables for bucket resolvers. Each top-level key names a request dimension; the inner map translates raw request values into compact bucket tokens.

 1define( 'MC_CACHE_BUCKETS', [
 2    'accept' => [ 'text/markdown' => 'md' ],
 3    'tenant' => [ 'acme' => 'acme', 'globex' => 'glx' ],
 4] );

Two built-in resolvers ship in MilliCache:

  • auth: Authorization header. Always-on correctness primitive: each unique bearer token gets its own cache entry. No config needed.
  • accept: Accept header content negotiation. Dormant unless MC_CACHE_BUCKETS['accept'] is configured. Parses with q-values and looks up the top-preferred MIME type.

Other dimensions need a resolver implementation. See Bucket Extension: the rules engine's set_bucket action is the no-code way to add them.

Note: Bucket tokens should be short: they're folded into the cache key. md, de, mobile are good; full MIME types or full UA strings are not.

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] );

Update Constants#Copied!

MC_UPDATE_PRERELEASE#Copied!

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

Opt in to prerelease builds. When defined truthy, the plugin requests prerelease versions from the update endpoint, so beta and release-candidate builds surface as available updates. Leave undefined to receive stable releases only.

To turn update checks off entirely, use the millicache_updates filter.

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_USERNAME', 'your-username' );
11define( 'MC_STORAGE_PASSWORD', 'secure-password' );
12define( 'MC_STORAGE_DB', 0 );
13define( 'MC_STORAGE_PERSISTENT', true );
14define( 'MC_STORAGE_PREFIX', 'mll_prod' );
15
16// Cache settings
17define( 'MC_CACHE_TTL', 86400 );        // 1 day
18define( 'MC_CACHE_GRACE', 2592000 );    // 30 days
19define( 'MC_CACHE_DEBUG', false );
20define( 'MC_CACHE_GZIP', true );
21
22// Exclusions
23define( 'MC_CACHE_NOCACHE_PATHS', [
24    '/my-account/*',
25    '/checkout/*',
26    '/cart/*',
27] );
28
29define( 'MC_CACHE_NOCACHE_COOKIES', [
30    'wp-*pass*',
31    'comment_author_*',
32] );
33
34define( 'MC_CACHE_IGNORE_COOKIES', [
35    '_*',
36    '__utm*',
37] );
38
39define( 'MC_CACHE_IGNORE_REQUEST_KEYS', [
40    '_*',
41    'utm_*',
42    'fbclid',
43    'gclid',
44] );
45
46/* That's all, stop editing! */

Next Steps#Copied!