Docket Cache
Search…
Constants
Docket Cache uses constants variable as main configuration methods.
Updated: 05-Dec-2020 | Version: >= 20.11.05
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_MAXTTL

Default object lifespan in seconds.
Only numbers between 86400 and 2419200 are allowed. Default: 345600 (4 days)
1
define('DOCKET_CACHE_MAXTTL', 345600);
Copied!
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)
1
define('DOCKET_CACHE_MAXSIZE', 3145728);
Copied!

Example of object data:

1
[
2
1606534363 => [
3
'wp_version_check' => [
4
'40cd750bba9870f18aada2478b24840a' => [
5
'schedule' => 'twicedaily',
6
'args' => [],
7
'interval' => 43200,
8
],
9
],
10
],
11
'version' => 2,
12
]
Copied!
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:

1
[
2
'timestamp' => 1606492052,
3
'site_id' => 1,
4
'group' => 'options',
5
'key' => 'cron',
6
'type' => 'string',
7
'timeout' => 1607701652,
8
'data' => [
9
1606534363 => [
10
'wp_version_check' => [
11
'40cd750bba9870f18aada2478b24840a' => [
12
'schedule' => 'twicedaily',
13
'args' => [],
14
'interval' => 43200,
15
],
16
],
17
],
18
'version' => 2,
19
],
20
]
Copied!

Docket Cache Metadata:

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

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)
1
define('DOCKET_CACHE_MAXSIZE_DISK', 524288000);
Copied!

DOCKET_CACHE_MAXFILE

Set the maximum cache file can be store on disk.
Only numbers between 200 and 1000000 are allowed. Default: 50000
1
define('DOCKET_CACHE_MAXFILE', 50000);
Copied!

DOCKET_CACHE_PATH

Set the cache directory. Default:
1
define('DOCKET_CACHE_PATH', WP_CONTENT_DIR.'/cache/docket-cache');
Copied!

DOCKET_CACHE_DATA_PATH

Set the configuration directory. Default:
1
define('DOCKET_CACHE_DATA_PATH', WP_CONTENT_DIR.'/docket-cache-data');
Copied!

DOCKET_CACHE_CONTENT_PATH

Set the Docket Cache writable directory. Default:
1
define('DOCKET_CACHE_CONTENT_PATH', WP_CONTENT_DIR);
Copied!
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:

1
$ sudo mkdir -p /opt/dc-content
2
$ sudo chown apache:apache /opt/dc-content
3
$ sumod chmod 755 /opt/dc-content
4
$ sudo ln -s /opt/dc-content/object-cache.php /your-wp-path/wp-content/object-cache.php
Copied!

Wrapper file:

1
<?php
2
if (!\defined('ABSPATH')) {
3
return;
4
}
5
6
if (!\defined('DOCKET_CACHE_CONTENT_PATH')) {
7
return;
8
}
9
10
if ( !@is_file(DOCKET_CACHE_CONTENT_PATH.'/object-cache.php') ) {
11
return;
12
}
13
14
@include_once DOCKET_CACHE_CONTENT_PATH.'/object-cache.php';
Copied!

Systemd PrivateTmp

If you're using /tmp as root path, you need to set PrivateTmp=false in systemd services like httpd.service or php-fpm.service.
Entersystemctl edit command.
1
$ sudo systemctl edit php-fpm.service
Copied!
Insert this setting.
1
[Service]
2
PrivateTmp=false
Copied!
Execute this command to restart php-fpm service.
1
$ sudo systemctl daemon-reload
2
$ sudo systemctl restart php-fpm
Copied!
Example file in CentOS 8: /usr/lib/systemd/system/php-fpm.service
1
# It's not recommended to modify this file in-place, because it
2
# will be overwritten during upgrades. If you want to customize,
3
# the best way is to use the "systemctl edit" command.
4
5
[Unit]
6
Description=The PHP FastCGI Process Manager
7
After=syslog.target network.target
8
9
[Service]
10
Type=notify
11
ExecStart=/usr/sbin/php-fpm --nodaemonize
12
ExecReload=/bin/kill -USR2 $MAINPID
13
PrivateTmp=false
14
RuntimeDirectory=php-fpm
15
RuntimeDirectoryMode=0755
16
17
[Install]
18
WantedBy=multi-user.target
19
Copied!

DOCKET_CACHE_FLUSH_DELETE

By default Docket Cache only empty the cache file. Set to true to delete the cache file when flushed. Default:
1
define('DOCKET_CACHE_FLUSH_DELETE', false);
Copied!

DOCKET_CACHE_GLOBAL_GROUPS

Set the lists of groups cached at the network level in a Multisite setup. Default:
1
define('DOCKET_CACHE_GLOBAL_GROUPS',
2
[
3
'blog-details',
4
'blog-id-cache',
5
'blog-lookup',
6
'global-posts',
7
'networks',
8
'rss',
9
'sites',
10
'site-details',
11
'site-lookup',
12
'site-options',
13
'site-transient',
14
'users',
15
'useremail',
16
'userlogins',
17
'usermeta',
18
'user_meta',
19
'userslugs'
20
]
21
);
Copied!

DOCKET_CACHE_IGNORED_GROUPS

List of cache groups that should not be cached. Default:
1
define('DOCKET_CACHE_IGNORED_GROUPS',
2
[
3
'counts',
4
'plugins',
5
'themes'
6
]
7
);
Copied!

DOCKET_CACHE_LOG

Set to true or false to enable or disable cache log. Default:
1
define('DOCKET_CACHE_LOG', false);
Copied!
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:
1
define('DOCKET_CACHE_LOG_FILE', WP_CONTENT_DIR.'/.object-cache.log');
Copied!

DOCKET_CACHE_LOG_TIME

Set the log time format when viewing. Available options utc, local, wp. Default:
1
define('DOCKET_CACHE_LOG_TIME', 'utc');
Copied!

DOCKET_CACHE_LOG_FLUSH

Set to true to empty the log file when the object cache is flushed. Default:
1
define('DOCKET_CACHE_LOG_FLUSH', true);
Copied!

DOCKET_CACHE_LOG_SIZE

Set the maximum size of the log file in bytes. Default: 10485760 (10MB)
1
define('DOCKET_CACHE_LOG_SIZE', 10485760);
Copied!

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:
1
define('DOCKET_CACHE_LOG_ALL', false);
Copied!

DOCKET_CACHE_ADVCPOST

Set to true to enable Advanced Post Cache features that cache WordPress Post Queries which results in faster data retrieval and reduced database workload. Default:
1
define('DOCKET_CACHE_ADVCPOST', true);
Copied!

DOCKET_CACHE_CRONOPTMZDB

Enable Database Tables optimization.
Available options: never, daily, weekly, monthly. Default:
1
define('DOCKET_CACHE_CRONOPTMZDB', 'never');
Copied!

DOCKET_CACHE_WPOPTALOAD

Set to true or false to enable or disable Suspend WP Options Autoload features. Default:
1
define('DOCKET_CACHE_WPOPTALOAD', false);
Copied!

DOCKET_CACHE_MISC_TWEAKS

Set to true or false to enable or disable miscellaneous WordPress performance tweaks. Default:
1
define('DOCKET_CACHE_MISC_TWEAKS', true);
Copied!

DOCKET_CACHE_WOOTWEAKS

Set to true or false to enable or disable miscellaneous WooCommerce tweaks. Default:
1
define('DOCKET_CACHE_WOOTWEAKS', true);
Copied!

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:
1
define('DOCKET_CACHE_WOOADMINOFF', false);
Copied!

DOCKET_CACHE_WOOWIDGETOFF

Set to true to disable WooCommerce Widget feature. Default:
1
define('DOCKET_CACHE_WOOWIDGETOFF', false);
Copied!

DOCKET_CACHE_WOOWPDASHBOARDOFF

Set to true to disable WooCommerce meta box in the WordPress Dashboard. Default:
1
define('DOCKET_CACHE_WOOWPDASHBOARDOFF', false);
Copied!

DOCKET_CACHE_WOOCARTFRAGSOFF

Set to true to disable WooCommerce Cart Fragments feature. Default:
1
define('DOCKET_CACHE_WOOWPDASHBOARDOFF', false);
Copied!

DOCKET_CACHE_POSTMISSEDSCHEDULE

Set to true or false to enable or disable Post Missed Schedule Tweaks features. Default:
1
define('DOCKET_CACHE_POSTMISSEDSCHEDULE', false);
Copied!

DOCKET_CACHE_OPTERMCOUNT

Set to true or false to enable or disable Term Count Queries optimization features. Default:
1
define('DOCKET_CACHE_OPTERMCOUNT', true);
Copied!

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:
1
define('DOCKET_CACHE_OPTWPQUERY', true);
Copied!

DOCKET_CACHE_MOCACHE

Set to true to enable WordPress Translation Caching features that improve the performance of the Translation function. Default:
1
define('DOCKET_CACHE_MOCACHE', false);
Copied!

DOCKET_CACHE_SIGNATURE

Set to true or false to enable or disable Docket Cache signature at HTML footer and Server Header. Default:
1
define('DOCKET_CACHE_SIGNATURE', true);
Copied!

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:
1
define('DOCKET_CACHE_PRECACHE', true);
Copied!

DOCKET_CACHE_PRECACHE_MAXFILE

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
1
define('DOCKET_CACHE_PRECACHE_MAXFILE', 0);
Copied!

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. Default:
1
define('DOCKET_CACHE_PRELOAD', false);
Copied!

DOCKET_CACHE_PAGELOADER

Set to true or false to enable or disable Admin Page Loader features. Default:
1
define('DOCKET_CACHE_PAGELOADER', true);
Copied!

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:
1
define('DOCKET_CACHE_CRONBOT', false);
Copied!

DOCKET_CACHE_CRONBOT_MAX

Maximum sites allowed in Multisite setup. Default:
1
define('DOCKET_CACHE_CRONBOT_MAX', 10);
Copied!

DOCKET_CACHE_GCACTION

Set to true to enable Docket Cache Garbage Collector action button at Overview section. Default:
1
define('DOCKET_CACHE_GCACTION', false);
Copied!

DOCKET_CACHE_AUTOUPDATE

Set to true or false to enable or disable Docket Cache auto-update. Default:
1
define('DOCKET_CACHE_AUTOUPDATE', true);
Copied!

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:
1
define('DOCKET_CACHE_CHECKVERSION', true);
Copied!

DOCKET_CACHE_STATS

Set to true or false to enable or disable object cache data stats at Overview page. Default:
1
define('DOCKET_CACHE_STATS', true);
Copied!

DOCKET_CACHE_PINGBACK

Set to true to disable WordPress XML-RPC and Pingbacks related features. Default:
1
define('DOCKET_CACHE_PINGBACK', false);
Copied!

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:
1
define('DOCKET_CACHE_HEADERJUNK', false);
Copied!

DOCKET_CACHE_WPEMOJI

Set to true to disable WordPress Emoji feature. Default:
1
define('DOCKET_CACHE_WPEMOJI', false);
Copied!

DOCKET_CACHE_WPFEED

Set to true to disable WordPress Feed feature. Default:
1
define('DOCKET_CACHE_WPFEED', false);
Copied!

DOCKET_CACHE_WPEMBED

Set to true to disable WordPress Embed feature. Default:
1
define('DOCKET_CACHE_WPEMBED', false);
Copied!

DOCKET_CACHE_WPLAZYLOAD

Set to true to disable WordPress Lazy Load feature. Default:
1
define('DOCKET_CACHE_WPLAZYLOAD', false);
Copied!

DOCKET_CACHE_WPSITEMAP

Set to true to disable WordPress Auto-Sitemap feature. Default:
1
define('DOCKET_CACHE_WPSITEMAP', false);
Copied!

DOCKET_CACHE_WPAPPPASSWORD

Set to true to disable WordPress Application Passwords feature. Default:
1
define('DOCKET_CACHE_WPAPPPASSWORD', false);
Copied!

DOCKET_CACHE_DISABLED

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:
1
define('DOCKET_CACHE_DISABLED', false);
Copied!
Last modified 3mo ago