Constants
Docket Cache uses constants variable as main configuration methods.
Updated: 05-Feb-2022 | Version: >= 21.08.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.Default object lifespan in seconds.
Only numbers between 86400 and 2419200 are allowed.
Default: 345600 (4 days)
define('DOCKET_CACHE_MAXTTL', 345600);
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) |
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)
define('DOCKET_CACHE_MAXSIZE', 3145728);
[
1606534363 => [
'wp_version_check' => [
'40cd750bba9870f18aada2478b24840a' => [
'schedule' => 'twicedaily',
'args' => [],
'interval' => 43200,
],
],
],
'version' => 2,
]
The size of the cache file is slightly bigger than the object since it contains Docket Cache metadata and exported as plain PHP code.
[
'timestamp' => 1606492052,
'site_id' => 1,
'group' => 'options',
'key' => 'cron',
'type' => 'string',
'timeout' => 1607701652,
'data' => [
1606534363 => [
'wp_version_check' => [
'40cd750bba9870f18aada2478b24840a' => [
'schedule' => 'twicedaily',
'args' => [],
'interval' => 43200,
],
],
],
'version' => 2,
],
]
Name | Description |
timestamp | Data creation time |
site_id | Site Id |
group | Object Cache group |
key | Object Cache key |
type | Object Cache Data type |
timeout | Expiration time |
data | Object Cache data |
Set the maximum size of the cache storage on disk.
The minimum required size is 104857600 bytes (100MB).
Default: 524288000 (500MB)
define('DOCKET_CACHE_MAXSIZE_DISK', 524288000);
Set the maximum cache file can be store on disk.
Only numbers between 200 and 1000000 are allowed.
Default: 50000
define('DOCKET_CACHE_MAXFILE', 50000);
Set the cache directory.
Default:
define('DOCKET_CACHE_PATH', WP_CONTENT_DIR.'/cache/docket-cache');
Set the configuration directory.
Default:
define('DOCKET_CACHE_DATA_PATH', WP_CONTENT_DIR.'/docket-cache-data');
Set the Docket Cache writable directory.
Default:
define('DOCKET_CACHE_CONTENT_PATH', WP_CONTENT_DIR);
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.$ sudo mkdir -p /opt/dc-content
$ sudo chown apache:apache /opt/dc-content
$ sumod chmod 755 /opt/dc-content
$ sudo ln -s /opt/dc-content/object-cache.php /your-wp-path/wp-content/object-cache.php
<?php
if (!\defined('ABSPATH')) {
return;
}
if (!\defined('DOCKET_CACHE_CONTENT_PATH')) {
return;
}
if ( !@is_file(DOCKET_CACHE_CONTENT_PATH.'/object-cache.php') ) {
return;
}
@include_once DOCKET_CACHE_CONTENT_PATH.'/object-cache.php';
By default Docket Cache only empty the cache file when expire. Set to true to delete the cache file instead of truncate.
Default:
define('DOCKET_CACHE_FLUSH_DELETE', false);
Set the lists of groups cached at the network level in a Multisite setup.
Default:
define('DOCKET_CACHE_GLOBAL_GROUPS',
[
'blog-details',
'blog-id-cache',
'blog-lookup',
'global-posts',
'networks',
'rss',
'sites',
'site-details',
'site-lookup',
'site-options',
'site-transient',
'users',
'useremail',
'userlogins',
'usermeta',
'user_meta',
'userslugs'
]
);
List of cache groups that should not be cached.
Default:
define('DOCKET_CACHE_IGNORED_GROUPS',
[
'counts',
'plugins',
'themes'
]
);
Set to
true
or false
to enable or disable cache log.
Default:define('DOCKET_CACHE_LOG', false);
The cache log intended to provide information on how the cache works. For performance and security concerns, deactivate if no longer needed.
Set the log file.
Default:
define('DOCKET_CACHE_LOG_FILE', WP_CONTENT_DIR.'/.object-cache.log');
Set the log time format when viewing. Available options utc, local, wp.
Default:
define('DOCKET_CACHE_LOG_TIME', 'utc');
Set to
true
to empty the log file when the object cache is flushed.
Default:define('DOCKET_CACHE_LOG_FLUSH', true);
Set the maximum size of the log file in bytes.
Default: 10485760 (10MB)
define('DOCKET_CACHE_LOG_SIZE', 10485760);
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:define('DOCKET_CACHE_LOG_ALL', false);
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. By default only for Post Type post, page and attachment.
Default:define('DOCKET_CACHE_ADVCPOST', true);
Enable Database Tables optimization.
Available options: never, daily, weekly, monthly.
Default:
define('DOCKET_CACHE_CRONOPTMZDB', 'never');
Set to
true
or false
to enable or disable Suspend WP Options Autoload features.
Default:define('DOCKET_CACHE_WPOPTALOAD', false);
Set to
true
or false
to enable or disable miscellaneous WordPress performance tweaks.
Default:define('DOCKET_CACHE_MISC_TWEAKS', true);
Set to
true
or false
to enable or disable miscellaneous WooCommerce tweaks.
Default:define('DOCKET_CACHE_WOOTWEAKS', true);
WooCommerce Admin or Analytics page is a new JavaScript-driven interface for managing stores.
Set to true to disable WooCommerce Admin feature-related.
Default:
define('DOCKET_CACHE_WOOADMINOFF', false);
Set to true to disable WooCommerce Widget feature.
Default:
define('DOCKET_CACHE_WOOWIDGETOFF', false);
Set to true to disable WooCommerce meta box in the WordPress Dashboard.
Default:
define('DOCKET_CACHE_WOOWPDASHBOARDOFF', false);
Set to true to disable WooCommerce Cart Fragments feature.
Default:
define('DOCKET_CACHE_WOOCARTFRAGSOFF', false);
Set to
true
or false
to enable or disable Post Missed Schedule Tweaks features.
Default:define('DOCKET_CACHE_POSTMISSEDSCHEDULE', false);
Set to
true
or false
to enable or disable Term Count Queries optimization features.
Default:define('DOCKET_CACHE_OPTERMCOUNT', true);
Set to
true
to enable WordPress Core Query optimization features. Docket Cache will attempt to optimize WordPress core query when enabled.
Default:define('DOCKET_CACHE_OPTWPQUERY', true);
Set to
true
to enable WordPress Translation Caching features that improve the performance of the Translation function.
Default:define('DOCKET_CACHE_MOCACHE', false);
Set to true to enable WordPress Menu Caching features that improve the performance of the WordPress menus generation.
Default:
define('DOCKET_CACHE_MENUCACHE', false);
Default Menu Cache lifespan in seconds.
Only numbers between 86400 and 2419200 are allowed.
Default: 1209600 (14 days)
define('DOCKET_CACHE_MENUCACHE_TTL', 1209600);
Set to
true
or false
to enable or disable Docket Cache signature at HTML footer and Server Header.
Default:define('DOCKET_CACHE_SIGNATURE', true);
Set to
true
to enable Object Cache Precaching features that increase cache performance by early loading cached objects based on the current URL.
Default:define('DOCKET_CACHE_PRECACHE', true);
Set the maximum precache file can be store on disk.
Only numbers between 0 and 1000000 are allowed. Set to 0 to disable it.
Default: 0
define('DOCKET_CACHE_PRECACHE_MAXFILE', 0);
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.
Default:define('DOCKET_CACHE_PRELOAD', false);
Set to
true
or false
to enable or disable Admin Page Loader features.
Default:define('DOCKET_CACHE_PAGELOADER', true);
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:define('DOCKET_CACHE_CRONBOT', false);
Maximum sites allowed in Multisite setup.
Default:
define('DOCKET_CACHE_CRONBOT_MAX', 10);
Set to true or false to enable or disable the OPcache viewer feature.
Default:
define('DOCKET_CACHE_OPCVIEWER', false);
Set to
true
to enable Docket Cache Garbage Collector action button at Overview section.
Default:define('DOCKET_CACHE_GCACTION', false);
Set to
true
or false
to enable or disable Docket Cache auto-update.
Default:define('DOCKET_CACHE_AUTOUPDATE', true);
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:define('DOCKET_CACHE_CHECKVERSION', true);
Set to
true
or false
to enable or disable object cache data stats at Overview page.
Default:define('DOCKET_CACHE_STATS', true);
Set to true to disable WordPress XML-RPC and Pingbacks related features.
Default:
define('DOCKET_CACHE_PINGBACK', false);
Set to true to disable WordPress features related to HTML header such as meta generators and feed links to reduce the page size.
Default:
define('DOCKET_CACHE_HEADERJUNK', false);
Set to true to disable WordPress Emoji feature.
Default:
define('DOCKET_CACHE_WPEMOJI', false);
Set to true to disable WordPress Feed feature.
Default:
define('DOCKET_CACHE_WPFEED', false);
Set to true to disable WordPress Embed feature.
Default:
define('DOCKET_CACHE_WPEMBED', false);
Set to true to disable WordPress Lazy Load feature.
Default:
define('DOCKET_CACHE_WPLAZYLOAD', false);
Set to true to disable WordPress Auto-Sitemap feature.
Default:
define('DOCKET_CACHE_WPSITEMAP', false);
Set to true to disable WordPress Application Passwords feature.
Default:
define('DOCKET_CACHE_WPAPPPASSWORD', false);
Set to true to disable WordPress Events & News Feed at Dashboard.
Default:
define('DOCKET_CACHE_WPDASHBOARDNEWS', false);
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:
define('DOCKET_CACHE_LIMITHTTPREQUEST', false);
Set the list of hosts excluded from Limit HTTP requests options.
Default:
define('DOCKET_CACHE_LIMITHTTPREQUEST_WHITELIST', []);
Example
define('DOCKET_CACHE_LIMITHTTPREQUEST_WHITELIST',
[
'feeds.feedburner.com',
'api.docketcache.com'
]
);
Set to true to disable the Docket Cache object cache feature at runtime. By defining to true, Docket Cache will ignore to install and uninstall the Drop-in file.
Default:
define('DOCKET_CACHE_DISABLED', false);
Last modified 8mo ago