Docket Cache baseline configuration
Avunu's wp-config.php baseline for the Docket Cache file-based object cache, with what each constant changes and which ones to leave out.
On this page
Docket Cache is a persistent object cache that stores cached objects as PHP files, so OPcache serves them from memory. Use it on hosts that don't offer Redis or Memcached. This page lists the constants Avunu sets in wp-config.php and why.
Constants in wp-config.php override the plugin's Configuration screen and lock those options in the admin, so the settings survive a database reset or a migration.
Note
Only one persistent object cache can be active, because they all use the same wp-content/object-cache.php drop-in. Don't run Docket Cache alongside Redis Object Cache or a host's built-in object cache. See wp-config Reference for the Redis alternative.
Baseline
Add this to wp-config.php above the /* That's all, stop editing! */ line:
// Docket Cache: storage limits.
define( 'DOCKET_CACHE_MAXFILE', 200000 ); // Default 50000.
define( 'DOCKET_CACHE_MAXSIZE_DISK', 2147483648 ); // 2 GB. Default 500 MB.
define( 'DOCKET_CACHE_CHUNKCACHEDIR', true ); // Spread files across subfolders.
define( 'DOCKET_CACHE_FLUSH_STALECACHE', true );
// Docket Cache: caching features.
define( 'DOCKET_CACHE_PRECACHE', true );
define( 'DOCKET_CACHE_MENUCACHE', true );
define( 'DOCKET_CACHE_MOCACHE', true );
define( 'DOCKET_CACHE_OPTERMCOUNT', true );
define( 'DOCKET_CACHE_OPTWPQUERY', true );
define( 'DOCKET_CACHE_MISC_TWEAKS', true );
define( 'DOCKET_CACHE_WOOTWEAKS', true );
define( 'DOCKET_CACHE_POSTMISSEDSCHEDULE', true );
define( 'DOCKET_CACHE_WPOPTALOAD', false );
// Docket Cache: trim WordPress features the site doesn't use.
define( 'DOCKET_CACHE_HEADERJUNK', true );
define( 'DOCKET_CACHE_WPEMOJI', true );
define( 'DOCKET_CACHE_WPDASHBOARDNEWS', true );
define( 'DOCKET_CACHE_WPBROWSEHAPPY', true );
define( 'DOCKET_CACHE_WPSERVEHAPPY', true );
define( 'DOCKET_CACHE_WPLAZYLOAD', false ); // Keep native lazy loading.
// Docket Cache: admin and maintenance.
define( 'DOCKET_CACHE_PAGELOADER', false );
define( 'DOCKET_CACHE_PRELOAD', true );
define( 'DOCKET_CACHE_GCACTION', true );
define( 'DOCKET_CACHE_FLUSHACTION', true );
define( 'DOCKET_CACHE_OPCSHUTDOWN', true );
define( 'DOCKET_CACHE_CRONOPTMZDB', 'weekly' );
define( 'DOCKET_CACHE_CRONBOT', false );
define( 'DOCKET_CACHE_STATS', false );
define( 'DOCKET_CACHE_LOG', false );
define( 'DOCKET_CACHE_LOG_ALL', false );
define( 'DOCKET_CACHE_SIGNATURE', false );
define( 'DOCKET_CACHE_CHECKVERSION', false );
define( 'DOCKET_CACHE_AUTOUPDATE', false );What the Settings Do
Storage Limits
| Constant | Value | Why |
|---|---|---|
DOCKET_CACHE_MAXFILE | 200000 | Maximum number of cache files. The default of 50,000 fills up quickly on WooCommerce sites, and the cache churns when it hits the limit. |
DOCKET_CACHE_MAXSIZE_DISK | 2147483648 | Total cache size on disk (2 GB). Check the account's disk and inode quota before raising it. |
DOCKET_CACHE_CHUNKCACHEDIR | true | Splits files into subfolders so one directory doesn't hold hundreds of thousands of files. Makes manual clearing and backups much faster. |
DOCKET_CACHE_FLUSH_STALECACHE | true | Removes stale WooCommerce and WordPress query caches instead of waiting for them to expire. |
Caching Features
| Constant | Value | Why |
|---|---|---|
DOCKET_CACHE_PRECACHE | true | Loads the objects a URL needed last time in one go, before WordPress asks for them. |
DOCKET_CACHE_MENUCACHE | true | Caches rendered navigation menus. Off by default. |
DOCKET_CACHE_MOCACHE | true | Caches translation files. Worth it on any site not in English, and harmless otherwise. |
DOCKET_CACHE_OPTERMCOUNT / OPTWPQUERY | true | Optimize term-count and core query patterns. |
DOCKET_CACHE_MISC_TWEAKS / WOOTWEAKS | true | General WordPress and WooCommerce performance tweaks (both default to on). |
DOCKET_CACHE_POSTMISSEDSCHEDULE | true | Publishes scheduled posts that WP-Cron missed. |
DOCKET_CACHE_WPOPTALOAD | false | Leaves option autoloading alone. Fix large autoloaded options directly instead (see Database Optimization Queries). |
Trimmed Features
Each of these turns a WordPress feature off when set to true.
| Constant | Effect |
|---|---|
DOCKET_CACHE_HEADERJUNK | Removes generator tags, RSD/WLW links, and similar clutter from <head>. |
DOCKET_CACHE_WPEMOJI | Removes the emoji detection script and styles. |
DOCKET_CACHE_WPDASHBOARDNEWS | Removes the Events and News dashboard widget and its remote requests. |
DOCKET_CACHE_WPBROWSEHAPPY / WPSERVEHAPPY | Stops the browser and PHP version checks that call WordPress.org from the admin. |
DOCKET_CACHE_WPLAZYLOAD | Set to false so native image lazy loading stays on. |
These remove features that some sites rely on. Enable them per site only when you're sure:
| Constant | Turns off | Leave it off when |
|---|---|---|
DOCKET_CACHE_WPFEED | RSS/Atom feeds | The site has a blog, podcast, or feed-driven integration. |
DOCKET_CACHE_WPSITEMAP | Core wp-sitemap.xml | No SEO plugin provides its own sitemap. |
DOCKET_CACHE_PINGBACK | XML-RPC and pingbacks | Jetpack, the mobile app, or another service uses XML-RPC. |
DOCKET_CACHE_WPAPPPASSWORD | Application Passwords | Any integration authenticates to the REST API with an application password. |
DOCKET_CACHE_LIMITHTTPREQUEST | Most outgoing HTTP requests from plugins on admin pages | Premium plugins need license checks or update requests. Use DOCKET_CACHE_LIMITHTTPREQUEST_WHITELIST for hosts that must get through. |
Admin and Maintenance
| Constant | Value | Why |
|---|---|---|
DOCKET_CACHE_PAGELOADER | false | Turns off the admin page-loading overlay. |
DOCKET_CACHE_PRELOAD | true | Warms common admin pages after a cache flush. |
DOCKET_CACHE_GCACTION / FLUSHACTION | true | Adds Garbage Collector and extra Flush buttons to the plugin screens. |
DOCKET_CACHE_OPCSHUTDOWN | true | Also flushes OPcache when the plugin is deactivated. |
DOCKET_CACHE_CRONOPTMZDB | 'weekly' | Runs OPTIMIZE TABLE on the WordPress tables weekly. Use 'never' on very large databases and optimize during a maintenance window. |
DOCKET_CACHE_CRONBOT | false | Cronbot is an external service that pings the site hourly. Use a real server cron instead (see WordPress Cron). |
DOCKET_CACHE_STATS / LOG / LOG_ALL | false | Avoids the overhead of stats and logging in production. Turn LOG on temporarily when troubleshooting. |
DOCKET_CACHE_SIGNATURE | false | Removes the Docket Cache HTML comment and response header. |
DOCKET_CACHE_CHECKVERSION | false | Skips the plugin's critical-version check. |
DOCKET_CACHE_AUTOUPDATE | false | Updates come through Avunu's normal update process instead of WordPress auto-updates. If nobody updates the site regularly, leave auto-updates on. |
Settings Left Out
Older copies of this baseline included constants that no longer do anything on current WordPress:
DOCKET_CACHE_ADVCPOSTand the related post-type constants: Advanced Post Cache only runs on WordPress 6.1 and older, because core now cachesWP_Queryresults itself.DOCKET_CACHE_RTIMAGEOVERWRITE: an internal runtime option that the plugin sets for itself. To keep only one copy of edited images, define WordPress's ownIMAGE_EDIT_OVERWRITEconstant instead.
Useful Commands
From the WordPress directory:
wp cache flush # Flush the object cache.
wp cache run:gc # Run Docket Cache's garbage collector now.
wp cache status # Show the drop-in status.Sources
This article is in the public domain (CC0 1.0), code samples included. Use it however helps you.