Configuration

Docket Cache uses constants variable as main configuration methods.

Updated: 27-Nov-2020

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

Cache file lifespan in seconds.

Only numbers between 86400 and 2419200 are allowed. Default: 4 days = 345600 seconds

define('DOCKET_CACHE_MAXTTL', 345600);

When Docket Cache saves the cache to the file, it will change file timestamp with expiration time. If no expiration time was supply, 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 value.

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 cache data in bytes.

Maximum allowed size is 10485760 bytes (10MB). Default: 3MB. 1MB = 1048576 bytes

define('DOCKET_CACHE_MAXSIZE', 3145728);

Example of cache data:

[
'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,
],
]

DOCKET_CACHE_MAXSIZE_DISK

Set the maximum size of the cache storage on disk.

Minimum allowed size is 104857600 bytes (100MB). Default: 500MB = 524288000

define('DOCKET_CACHE_MAXSIZE_DISK', 524288000);

DOCKET_CACHE_MAXFILE

Set the maximum file of cache can be store on disk.

Only numbers between 200 and 1000000 are allowed. Default: 50000

define('DOCKET_CACHE_MAXFILE', 50000);

DOCKET_CACHE_PATH

Set the cache directory. Default:

define('DOCKET_CACHE_PATH', WP_CONTENT_DIR.'/cache/docket-cache');

DOCKET_CACHE_DATA_PATH

Set the configuration directory. Default:

define('DOCKET_CACHE_DATA_PATH', WP_CONTENT_DIR.'/docket-cache-data/');

DOCKET_CACHE_CONTENT_PATH

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.

Please refer to the PHP open_basedir setting before set this constant.

Example:

$ 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

Wrapper file:

<?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';

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.

$ sudo systemctl edit php-fpm.service

Insert this setting.

[Service]
PrivateTmp=false

Execute this command to restart php-fpm service.

$ sudo systemctl daemon-reload
$ sudo systemctl restart php-fpm

Example file in CentOS 8: /usr/lib/systemd/system/php-fpm.service

# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades. If you want to customize,
# the best way is to use the "systemctl edit" command.
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=notify
ExecStart=/usr/sbin/php-fpm --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=false
RuntimeDirectory=php-fpm
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target

DOCKET_CACHE_FLUSH_DELETE

By default Docket Cache only empty the cache file. Set to true to delete the cache file when flushed. Default:

define('DOCKET_CACHE_FLUSH_DELETE', false);

DOCKET_CACHE_GLOBAL_GROUPS

Set the lists of cache groups that share a cache with other sites 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'
]
);

DOCKET_CACHE_IGNORED_GROUPS

List of cache groups that should not be cached. Default:

define('DOCKET_CACHE_IGNORED_GROUPS',
[
'counts',
'plugins',
'themes'
]
);

DOCKET_CACHE_LOG

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.

DOCKET_CACHE_LOG_FILE

Set the log file. Default:

define('DOCKET_CACHE_LOG_FILE', WP_CONTENT_DIR.'/.object-cache.log');

DOCKET_CACHE_LOG_TIME

Set the log time format when viewing. Available options utc, local, wp. Default:

define('DOCKET_CACHE_LOG_TIME', 'utc');

DOCKET_CACHE_LOG_FLUSH

Set to true to empty the log file when the object cache is flushed. Default:

define('DOCKET_CACHE_LOG_FLUSH', true);

DOCKET_CACHE_LOG_SIZE

Set the maximum size of the log file in bytes. Default: 10MB. 1MB = 1048576 bytes

define('DOCKET_CACHE_LOG_SIZE', 10485760);

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:

define('DOCKET_CACHE_LOG_ALL', false);

DOCKET_CACHE_ADVCPOST

Set to true or false to enable or disable Advanced Post Cache features. Default:

define('DOCKET_CACHE_ADVCPOST', true);

DOCKET_CACHE_CRONOPTMZDB

Enable Database Tables optimization.

Available options: never, daily, weekly, monthly. Default:

define('DOCKET_CACHE_CRONOPTMZDB', 'never');

DOCKET_CACHE_WPOPTALOAD

Set to true or false to enable or disable Suspend WP Options Autoload features. Default:

define('DOCKET_CACHE_WPOPTALOAD', false);

DOCKET_CACHE_MISC_TWEAKS

Set to true or false to enable or disable miscellaneous WordPress performance tweaks. Default:

define('DOCKET_CACHE_MISC_TWEAKS', true);

DOCKET_CACHE_WOOTWEAKS

Set to true or false to enable or disable miscellaneous WooCommerce tweaks. Default:

define('DOCKET_CACHE_WOOTWEAKS', true);

DOCKET_CACHE_POSTMISSEDSCHEDULE

Set to true or false to enable or disable Post Missed Schedule Tweaks features. Default:

define('DOCKET_CACHE_POSTMISSEDSCHEDULE', false);

DOCKET_CACHE_OPTERMCOUNT

Set to true or false to enable or disable Term Count Queries optimization features. Default:

define('DOCKET_CACHE_OPTERMCOUNT', true);

DOCKET_CACHE_OPTWPQUERY

Set to true or false to enable or disable WordPress Core Query optimization features. Default:

define('DOCKET_CACHE_OPTWPQUERY', true);

DOCKET_CACHE_MOCACHE

Set to true or false to enable or disable WordPress Translation Caching features. Default:

define('DOCKET_CACHE_MOCACHE', false);

DOCKET_CACHE_SIGNATURE

Set to true or false to enable or disable Docket Cache signature at HTML footer and Server Header. Default:

define('DOCKET_CACHE_SIGNATURE', true);

DOCKET_CACHE_PRECACHE

Set to true or false to enable or disable Object Cache Precaching features. Default:

define('DOCKET_CACHE_PRECACHE', true);

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:

define('DOCKET_CACHE_PRELOAD', false);

DOCKET_CACHE_PAGELOADER

Set to true or false to enable or disable Admin Page Loader features. Default:

define('DOCKET_CACHE_PAGELOADER', true);

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:

define('DOCKET_CACHE_CRONBOT', false);

DOCKET_CACHE_CRONBOT_MAX

Maximum sites allowed in Multisite setup. Default:

define('DOCKET_CACHE_CRONBOT_MAX', 10);

DOCKET_CACHE_AUTOUPDATE

Set to true or false to enable or disable Docket Cache auto-update. Default:

define('DOCKET_CACHE_AUTOUPDATE', true);

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:

define('DOCKET_CACHE_CHECKVERSION', true);

DOCKET_CACHE_STATS

Set to true or false to enable or disable object cache data stats at Overview page. Default:

define('DOCKET_CACHE_STATS', true);

DOCKET_CACHE_DISABLED

Set to true to disable the object cache at runtime. No persistent cached objects at this time. Default:

define('DOCKET_CACHE_DISABLED', false);