WP-CLI Commands
Complete reference for MilliCache command-line interface.
Quick Reference#
| 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 export |
Export settings |
wp millicache config import |
Import settings |
Cache Commands#
wp millicache clear#
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#
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#
wp millicache config get#
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 |
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# Show setting sources
11wp millicache config get --show-source
Source values:
constant— Defined in wp-config.phpfile— Set in config filedatabase— Saved via admin or CLIdefault— Built-in default value
wp millicache config set#
Set a configuration value.
1wp millicache config set <key> <value>
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)
11wp millicache config set storage.enc_password "secret"
wp millicache config reset#
Reset settings to default values.
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 restore#
Restore settings from automatic backup.
1wp millicache config restore
Backups are created before reset/import operations and expire after 12 hours.
wp millicache config export#
Export settings to file or stdout.
1wp millicache config export [--file=<path>] [--format=<format>]
Examples:
1# Export to stdout
2wp millicache config export
3
4# Export to file
5wp millicache config export --file=settings.json
6
7# Export as YAML
8wp millicache config export --format=yaml
wp millicache config import#
Import settings from file.
1wp millicache config import --file=<path> [--yes]
Examples:
1# Import from file
2wp millicache config import --file=settings.json
3
4# Skip confirmation
5wp millicache config import --file=settings.json --yes
Diagnostic Commands#
wp millicache status#
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#
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#
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#
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#
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#
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#
After Deployment#
1wp millicache drop --force
2wp millicache test
3wp millicache clear
Debugging#
1wp millicache status
2wp millicache test
3wp millicache config set cache.debug true
4wp millicache stats
Backup and Restore Settings#
1# Backup
2wp millicache config export --file=backup.json
3
4# Restore
5wp millicache config import --file=backup.json
Health Check Script#
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#
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Error |
Help#
1# General help
2wp help millicache
3
4# Command-specific help
5wp help millicache clear
6wp help millicache config
Next Steps#
- Configuration Reference — All constants
- Cache Clearing — Clearing strategies
- Troubleshooting — Common issues