WP-CLI Commands

Complete reference for MilliCache command-line interface.

Quick Reference#Copied!

Command Description
wp millicache clear Clear cache entries
wp millicache stats View cache statistics
wp millicache status Show plugin and connection status
wp millicache test Test Redis connection
wp millicache drop Install/repair advanced-cache.php
wp millicache cli Open interactive Redis CLI
wp millicache config get View configuration
wp millicache config set Set configuration value
wp millicache config reset Reset to defaults
wp millicache config backup Create settings backup
wp millicache config restore Restore settings from backup
wp millicache config export Export settings as JSON
wp millicache config import Import settings from JSON

Cache Commands#Copied!

wp millicache clear#Copied!

Clear cached entries with various targeting options.

 1wp millicache clear [--id=<id>] [--url=<url>] [--flag=<flag>]
 2                    [--site=<site>] [--network=<network>] [--expire]

Options:

Option Description
--id=<id> Comma-separated post IDs
--url=<url> Comma-separated URLs
--flag=<flag> Comma-separated cache flags (supports wildcards)
--site=<site> Comma-separated site IDs (multisite)
--network=<network> Comma-separated network IDs (multisite)
--expire Expire instead of delete (serve stale during regeneration)

Examples:

 1# Clear all cache
 2wp millicache clear
 3
 4# Clear specific posts
 5wp millicache clear --id=1,2,3,42
 6
 7# Clear by URLs
 8wp millicache clear --url="https://example.com/,https://example.com/about/"
 9
10# Clear by flags
11wp millicache clear --flag="home,archive:post"
12
13# Clear with wildcard
14wp millicache clear --flag="post:*"
15
16# Expire instead of delete
17wp millicache clear --expire
18
19# Multisite: clear specific sites
20wp millicache clear --site=1,2,3
21
22# Multisite: clear entire network
23wp millicache clear --network=1

wp millicache stats#Copied!

Display cache statistics.

 1wp millicache stats [--flag=<flag>] [--format=<format>]

Options:

Option Description
--flag=<flag> Filter by flag pattern (supports wildcards)
--format=<format> Output: table, json, yaml (default: table)

Examples:

 1# Basic statistics
 2wp millicache stats
 3
 4# Filter by flag pattern
 5wp millicache stats --flag="post:*"
 6
 7# JSON output
 8wp millicache stats --format=json

Output:

+----------+---------+
| property | value   |
+----------+---------+
| entries  | 142     |
| size     | 2856432 |
| size_h   | 2.7 MB  |
| avg_size | 20.1 KB |
+----------+---------+

Configuration Commands#Copied!

Configuration commands are provided by the MilliBase framework and manage settings using a priority hierarchy: constants > file > database > defaults.

wp millicache config get#Copied!

Display current configuration values.

 1wp millicache config get [<key>] [--show-source] [--format=<format>]

Options:

Option Description
<key> Module or setting key (e.g., cache or cache.ttl)
--show-source Show where each value comes from
--format=<format> Output: table, json, yaml, csv (default: table)

Examples:

 1# View all settings
 2wp millicache config get
 3
 4# View specific module
 5wp millicache config get cache
 6
 7# View specific setting
 8wp millicache config get cache.ttl
 9
10# View setting as JSON
11wp millicache config get cache.ttl --format=json
12
13# Show setting sources
14wp millicache config get --show-source

Source values:

  • constant — Defined in wp-config.php
  • file — Set in config file
  • database — Saved via admin or CLI
  • default — Built-in default value

wp millicache config set#Copied!

Set a configuration value.

 1wp millicache config set <key> <value>

Values are automatically coerced: "true"/"false" become booleans, "null" becomes null, and numeric strings become numbers.

Examples:

 1# Set TTL
 2wp millicache config set cache.ttl 3600
 3
 4# Set boolean
 5wp millicache config set cache.debug true
 6
 7# Set array (JSON format)
 8wp millicache config set cache.nocache_paths '["/cart/*", "/checkout/*"]'
 9
10# Set password (automatically encrypted, masked in output)
11wp millicache config set storage.enc_password "secret"
Note: Settings defined via constants cannot be overridden via CLI.

wp millicache config reset#Copied!

Reset settings to default values. A backup is automatically created before resetting.

 1wp millicache config reset [--module=<module>] [--yes]

Options:

Option Description
--module=<module> Reset specific module: storage, cache, rules
--yes Skip confirmation

Examples:

 1# Reset all settings
 2wp millicache config reset
 3
 4# Reset specific module
 5wp millicache config reset --module=cache
 6
 7# Skip confirmation
 8wp millicache config reset --yes

wp millicache config backup#Copied!

Create a manual backup of current settings.

 1wp millicache config backup

Backups expire after 12 hours and are also created automatically before reset and import operations.

wp millicache config restore#Copied!

Restore settings from the most recent backup.

 1wp millicache config restore

wp millicache config export#Copied!

Export settings as JSON to stdout or file.

 1wp millicache config export [--file=<path>] [--module=<module>] [--include-encrypted]

Options:

Option Description
--file=<path> Write to file instead of stdout
--module=<module> Export only a specific module
--include-encrypted Include decrypted values of encrypted fields

Examples:

 1# Export to stdout
 2wp millicache config export
 3
 4# Export to file
 5wp millicache config export --file=settings.json
 6
 7# Export only cache module
 8wp millicache config export --module=cache
 9
10# Include encrypted fields
11wp millicache config export --include-encrypted --file=full-backup.json

wp millicache config import#Copied!

Import settings from a JSON file. A backup is automatically created before importing.

 1wp millicache config import --file=<path> [--merge] [--no-merge] [--yes]

Options:

Option Description
--file=<path> Path to JSON file (required)
--merge Merge with existing settings (default)
--no-merge Replace all settings with imported values
--yes Skip confirmation

Examples:

 1# Import from file (merges by default)
 2wp millicache config import --file=settings.json
 3
 4# Replace all settings
 5wp millicache config import --file=settings.json --no-merge
 6
 7# Skip confirmation
 8wp millicache config import --file=settings.json --yes

Diagnostic Commands#Copied!

wp millicache status#Copied!

Display comprehensive plugin and cache status.

 1wp millicache status [--format=<format>]

Output:

+-------------------+------------------+
| property          | status           |
+-------------------+------------------+
| plugin_version    | 1.0.0            |
| wp_cache          | enabled          |
| advanced_cache    | symlink          |
| storage_connected | yes              |
| storage_version   | 7.2.4            |
| storage_memory    | 12.5 MB / 256 MB |
| cache_entries     | 142              |
| cache_size        | 2.7 MB           |
+-------------------+------------------+

wp millicache test#Copied!

Run comprehensive Redis connection tests.

 1wp millicache test

Output:

+-------------+--------+------------------+
| test        | status | info             |
+-------------+--------+------------------+
| Connection  | PASS   | Connected        |
| Ping        | PASS   | 0.23ms           |
| Write       | PASS   | Stored test data |
| Read        | PASS   | Data verified    |
| Delete      | PASS   | Cleaned up       |
+-------------+--------+------------------+

wp millicache drop#Copied!

Install or repair the advanced-cache.php drop-in file.

 1wp millicache drop [--force]

Options:

Option Description
--force Force reinstall even if current

Examples:

 1# Standard install/fix
 2wp millicache drop
 3
 4# Force reinstall
 5wp millicache drop --force

wp millicache cli#Copied!

Open an interactive Redis CLI session.

 1wp millicache cli

Requires redis-cli installed on the system. Launches with configured connection settings.

Common Redis commands once connected:

 1PING                    # Check connection
 2KEYS mll:*              # List MilliCache keys
 3DBSIZE                  # Get key count
 4INFO memory             # Check memory usage
 5QUIT                    # Exit CLI

Multisite Usage#Copied!

In multisite installations:

 1# Run on specific site
 2wp millicache clear --url=site1.example.com
 3
 4# Clear specific sites
 5wp millicache clear --site=1,2,3
 6
 7# Clear entire network
 8wp millicache clear --network=1
 9
10# Stats for specific site
11wp millicache stats --flag="2:*"

Output Formats#Copied!

Most commands support multiple formats:

 1# Table (default)
 2wp millicache status
 3
 4# JSON
 5wp millicache status --format=json
 6
 7# YAML
 8wp millicache status --format=yaml

Common Workflows#Copied!

After Deployment#Copied!

 1wp millicache drop --force
 2wp millicache test
 3wp millicache clear

Debugging#Copied!

 1wp millicache status
 2wp millicache test
 3wp millicache config set cache.debug true
 4wp millicache stats

Backup and Restore Settings#Copied!

 1# Create a manual backup
 2wp millicache config backup
 3
 4# Restore from backup
 5wp millicache config restore
 6
 7# Export to file for external backup
 8wp millicache config export --file=backup.json
 9
10# Import from file
11wp millicache config import --file=backup.json

Health Check Script#Copied!

 1#!/bin/bash
 2if wp millicache test; then
 3    echo "Redis connection OK"
 4else
 5    echo "Redis connection failed"
 6    exit 1
 7fi

Exit Codes#Copied!

Code Meaning
0 Success
1 Error

Help#Copied!

 1# General help
 2wp help millicache
 3
 4# Command-specific help
 5wp help millicache clear
 6wp help millicache config

Next Steps#Copied!