Constants
Docket Cache uses constants variable as main configuration methods.
Updated: 08-Mar-2023 | v22.07.04
Constants are like variables except that once they are defined they cannot be changed or undefined. To change the behaviour of Docket Cache, the following PHP constants can be defined in your wp-config.php
file.
Docket Cache load the configuration by calling Constan::register_default()
method that can be found in file includes/src/Constans.php. Some constant marks as @private and for internal use, changing it may result in unpredictable behaviour.
DOCKET_CACHE_MAXTTL
Default object lifespan in seconds.
Only numbers between 86400 and 2419200 are allowed. Default: 345600 (4 days)
If there is no expire time was set to object or set to 0, Docket Cache will use this setting as an expiration time.
This setting does not apply to cache groups below if the value of seconds is lower than the predefined seconds.
Group | Key | Seconds |
site-transient | update_plugins, update_themes, update_core | 2419200 (28 days) |
site-transient | any | 604800 (7 days) |
transient | any | 604800 (7 days) |
terms | any | 1209600 (14 days) |
posts | any | 1209600 (14 days) |
post_meta | any | 1209600 (14 days) |
comments | any | 1209600 (14 days) |
options | any | 1209600 (14 days) |
site-options | any | 1209600 (14 days) |
DOCKET_CACHE_MAXSIZE
Set the maximum size of the object data in bytes, which can be store in a cache file.
Only size between 1048576 (1MB) and 10485760 (10MB) are allowed. Default: 3145728 (3MB)
Example of object data:
The size of the cache file is slightly bigger than the object since it contains Docket Cache metadata and exported as plain PHP code.
Example of the cache file content:
Docket Cache Metadata:
Name | Description |
---|---|
timestamp | Data creation time |
site_id | Site Id |
network_id | Network Id (on multisite) |
group | Object Cache group |
key | Object Cache key |
type | Object Cache Data type |
timeout | Expiration time |
data | Object Cache data |
DOCKET_CACHE_MAXSIZE_DISK
Set the maximum size of the cache storage on disk.
The minimum required size is 104857600 bytes (100MB). Default: 524288000 (500MB)
DOCKET_CACHE_MAXFILE
Set the maximum cache file can be store on disk.
Only numbers between 200 and 1000000 are allowed. Default: 50000
DOCKET_CACHE_CHUNKCACHEDIR
Set to true
to enable chunking cache files into smaller directories to avoid an excessive number of cache files in one directory.
Only enable it if you have difficulty clearing the cache manually or experience slowdowns when the cache becomes too large. Default:
DOCKET_CACHE_MAXFILE_LIVECHECK
Set to true
to allow Docket Cache to monitor the cache file limit in real-time.
Default:
DOCKET_CACHE_EMPTYCACHE_IGNORE
Set to true
to enable excluding empty caches from being stored on disk.
Only enable it if you have an issue with inode/file limits. Default:
DOCKET_CACHE_PATH
Set the cache directory. Default:
DOCKET_CACHE_DATA_PATH
Set the configuration directory. Default:
DOCKET_CACHE_CONTENT_PATH
Set the Docket Cache writable directory. Default:
By default, Docket Cache requires writable permission on WordPress wp-content directory for internal use. Defining this constant also change the default path for cache, configuration and object-cache Drop-In. The content path must exist and has proper permission. The object-cache.php
Drop-In file needs to symlink with WordPress wp-content/object-cache.php
or replace with wrapper file.
Please refer to the PHP open_basedir
setting before set this constant.
Example:
Wrapper file:
DOCKET_CACHE_FLUSH_DELETE
By default Docket Cache only empty the cache file when expire. Set to true to delete the cache file instead of truncate. Default:
DOCKET_CACHE_FLUSH_STALECACHE
Set to true
to allow Garbage Collector (GC) immediately remove the stale cache abandoned by WordPress, WooCommerce and others after doing cache invalidation.
Default:
DOCKET_CACHE_STALECACHE_IGNORE
Set to true
to enable excluding stale cache created by WordPress, WooCommerce, and others from being stored on disk.
Default:
Only enable it if you have an issue with inode/file limits.
DOCKET_CACHE_GLOBAL_GROUPS
Set the lists of groups cached at the network level in a Multisite setup. Default:
DOCKET_CACHE_IGNORED_GROUPS
List of cache groups that should not be cached. Default:
DOCKET_CACHE_IGNORED_KEYS
List of cache keys that should not be cached. Default: not set.
Example:
DOCKET_CACHE_IGNORED_GROUPKEY
List of cache groups and keys that should not be cached. Default: not set.
DOCKET_CACHE_LOG
Set to true
or false
to enable or disable cache log.
Default:
The cache log intended to provide information on how the cache works. For performance and security concerns, deactivate if no longer needed.
DOCKET_CACHE_LOG_FILE
Set the log file. Default:
DOCKET_CACHE_LOG_TIME
Set the log time format when viewing. Available options utc, local, wp. Default:
DOCKET_CACHE_LOG_FLUSH
Set to true
to empty the log file when the object cache is flushed.
Default:
DOCKET_CACHE_LOG_SIZE
Set the maximum size of the log file in bytes. Default: 10485760 (10MB)
DOCKET_CACHE_LOG_ALL
By default, Docket Cache excludes it own process if WP_DEBUG not defined as true.
Set to true
or false
to enable or disable to log all caches.
Default:
DOCKET_CACHE_ADVCPOST
Set to true
to enable Advanced Post Cache features that cache WP Queries for a post which results in faster data retrieval and reduced database workload.
Default:
Since version 22.07.04, the Advanced Post Cache feature is only available for WordPress version 6.1 and below. Since it is already implemented in WordPress Core as WP_Query caching.
DOCKET_CACHE_ADVCPOSTTYPE
List of Post Types allowed for Advanced Post Cache. Default:
Since version 22.07.04, this constant only works for WordPress version 6.1 and below.
DOCKET_CACHE_ADVCPOSTTYPE_ALL
Set to true to allow all Post Types for Advanced Post Cache. Default:
Since version 22.07.04, this constant only works for WordPress version 6.1 and below.
DOCKET_CACHE_CRONOPTMZDB
Enable Database Tables optimization.
Available options: never, daily, weekly, monthly. Default:
DOCKET_CACHE_WPOPTALOAD
Set to true
or false
to enable or disable Suspend WP Options Autoload features.
Default:
DOCKET_CACHE_MISC_TWEAKS
Set to true
or false
to enable or disable miscellaneous WordPress performance tweaks.
Default:
DOCKET_CACHE_WOOTWEAKS
Set to true
or false
to enable or disable miscellaneous WooCommerce tweaks.
Default:
DOCKET_CACHE_WOOADMINOFF
WooCommerce Admin or Analytics page is a new JavaScript-driven interface for managing stores.
Set to true to disable WooCommerce Admin feature-related. Default:
DOCKET_CACHE_WOOWIDGETOFF
Set to true to disable WooCommerce Classic Widget feature. Default:
DOCKET_CACHE_WOOWPDASHBOARDOFF
Set to true to disable WooCommerce meta box in the WordPress Dashboard. Default:
DOCKET_CACHE_WOOCARTFRAGSOFF
Set to true to disable WooCommerce Cart Fragments feature. Default:
DOCKET_CACHE_WOOADDTOCHARTCRAWLING
Set to true to enable prevent robots crawling add-to-cart links. Default:
DOCKET_CACHE_WOOEXTENSIONPAGEOFF
Set to true to disable WooCommerce Extensions Page feature. Default:
DOCKET_CACHE_POSTMISSEDSCHEDULE
Set to true
or false
to enable or disable Post Missed Schedule Tweaks features.
Default:
DOCKET_CACHE_OPTERMCOUNT
Set to true
or false
to enable or disable Term Count Queries optimization features.
Default:
DOCKET_CACHE_OPTWPQUERY
Set to true
to enable WordPress Core Query optimization features. Docket Cache will attempt to optimize WordPress core query when enabled.
Default:
DOCKET_CACHE_LIMITBULKEDIT
Set to true
or false
to enable or disable the Bulk Edit Actions when reaching the listed item limit.
Default:
DOCKET_CACHE_LIMITBULKEDIT_LIMIT
Set a limit of items listed for Bulk Edit Actions. Default:
DOCKET_CACHE_MOCACHE
Set to true
to enable WordPress Translation Caching features that improve the performance of the Translation function.
Default:
DOCKET_CACHE_MENUCACHE
Set to true to enable WordPress Menu Caching features that improve the performance of the WordPress menus generation. Default:
DOCKET_CACHE_MENUCACHE_TTL
Default Menu Cache lifespan in seconds.
Only numbers between 86400 and 2419200 are allowed. Default: 1209600 (14 days)
DOCKET_CACHE_SIGNATURE
Set to true
or false
to enable or disable Docket Cache signature at HTML footer and Server Header.
Default:
DOCKET_CACHE_PRECACHE
Set to true
to enable Object Cache Precaching features that increase cache performance by early loading cached objects based on the current URL.
Default:
DOCKET_CACHE_PRECACHE_MAXFILE
Set the maximum precache file can be store on disk.
Only numbers between 100 and 1000000 are allowed. Default: 100
DOCKET_CACHE_PRECACHE_MAXKEY
Set the maximum precache keys. Default: 20
DOCKET_CACHE_PRECACHE_MAXGROUP
Set the maximum precache groups. Default: 20
DOCKET_CACHE_IGNORED_PRECACHE
List of cache groups and keys that should not be precached. Default:
DOCKET_CACHE_PRELOAD
Set to true
or false
to enable or disable cache preloading. If set to true
, this plugin will fetch predefined URL related to the admin page.
The preload only runs when doing a cache flush. Default:
DOCKET_CACHE_PAGELOADER
Set to true
or false
to enable or disable Admin Page Loader features.
Default:
DOCKET_CACHE_TRANSIENTDB
By default WordPress stores Transients Cache in Database. When a persistent object cache is available, it switches Transients from Database to the object cache.
Some plugins use Transients not in the right way, they store too big data without expiration time. Without expiration, WordPress will place the Transient in the "alloptions" variable. It will make persistent object caching solutions like Docket Cache unable to handle it.
Set to true
or false
to enable or disable retaining Transients in the Database.
Default:
DOCKET_CACHE_IGNORED_TRANSIENTDB
A list of Transient names is excluded from being stored in the Database. Default:
DOCKET_CACHE_CRONBOT
The Cronbot is an external service that pings your website every hour to keep WordPress Cron running actively. Only site Timezone, URL and version are involved when enabling this service.
Set to true
or false
to enable or disable Cronbot Service.
Default:
DOCKET_CACHE_CRONBOT_MAX
Maximum sites allowed in Multisite setup. Default:
DOCKET_CACHE_OPCVIEWER
Set to true or false to enable or disable the OPcache viewer feature. Default:
DOCKET_CACHE_GCACTION
Set to true
to enable Docket Cache Garbage Collector action button at Overview screen.
Default:
DOCKET_CACHE_FLUSHACTION
Set to true
to enable Docket Cache the additional Flush Cache action button on the Configuration screen.
Default:
DOCKET_CACHE_AUTOUPDATE
Set to true
or false
to force enable or disable automatic updates of the Docket Cache.
Default:
DOCKET_CACHE_CHECKVERSION
The Check Version allows Docket Cache to check any critical future version that requires removing cache files before doing the updates, purposely to avoid error-prone.
Set to true
or false
to enable or disable critical version checking.
Default:
DOCKET_CACHE_FLUSH_SHUTDOWN
Set to true
or false
to enable or disable to flush the object cache when disabling or uninstalling Docket Cache.
Default:
DOCKET_CACHE_OPCSHUTDOWN
Set to true
or false
to enable or disable to flush OPcache when disabling or uninstalling Docket Cache.
DOCKET_CACHE_STATS
Set to true
or false
to enable or disable object cache data stats at Overview screen.
Default:
DOCKET_CACHE_PINGBACK
Set to true to disable WordPress XML-RPC and Pingbacks related features. Default:
DOCKET_CACHE_HEADERJUNK
Set to true to disable WordPress features related to HTML header such as meta generators and feed links to reduce the page size. Default:
DOCKET_CACHE_WPEMOJI
Set to true to disable WordPress Emoji feature. Default:
DOCKET_CACHE_WPFEED
Set to true to disable WordPress Feed feature. Default:
DOCKET_CACHE_WPEMBED
Set to true to disable WordPress Embed feature. Default:
DOCKET_CACHE_WPLAZYLOAD
Set to true to disable WordPress Lazy Load feature. Default:
DOCKET_CACHE_WPSITEMAP
Set to true to disable WordPress Auto-Sitemap feature. Default:
DOCKET_CACHE_WPAPPPASSWORD
Set to true to disable WordPress Application Passwords feature. Default:
DOCKET_CACHE_WPDASHBOARDNEWS
Set to true to disable WordPress Events & News Feed at Dashboard. Default:
DOCKET_CACHE_WPBROWSEHAPPY
Set to true to disable the WordPress Browse Happy HTTP API requests, which checks whether the user needs a browser update. Default:
DOCKET_CACHE_WPSERVEHAPPY
Set to true to disable the WordPress Serve Happy HTTP API request, which checks whether the user needs to update PHP. Default:
DOCKET_CACHE_POSTVIAEMAIL
Set to true to disable the WordPress post-via-email functionality. Default:
DOCKET_CACHE_LIMITHTTPREQUEST
Set to true to limit HTTP requests in WP-Admin.
This option will block any HTTP requests made by plugins or themes that used wp_remote_post
, wp_remote_get
or wp_remote_request
functions that are not invoked in standard WP-Admin pages like Post, Pages, Plugins, Media and others.
Default:
DOCKET_CACHE_LIMITHTTPREQUEST_WHITELIST
Set the list of hosts excluded from Limit HTTP requests options. Default:
Example:
DOCKET_CACHE_GCRON_DISABLED
Set to true to disable Garbage Collector Cron Events. By defining it as true, Docket Cache will not install Cron Event for Garbage Collector. You need to run it manually using wp-cli or a custom Cron Events. Default:
Example for WP-CLI:
Example for custom Cron Events:
DOCKET_CACHE_DISABLED
Set to true to disable the Docket Cache object cache feature at runtime. By defining it as true, Docket Cache will ignore to install and uninstall the Drop-in file. Default:
Last updated