Configuration

The deployment of WPTRUECACHE-HA component was designed towards simplicity with minimal configuration changes if needed. The component consists of a packaged plug in that is placed in the wp-content/plugins directory of the wordpress installation, resulting in a new directory wptruecache. Before installing this file, there must be NO existing advanced-cache.php otherwise you will break other functionality when installing the WPTRUECACHE-HA.

You must then activate the plugin just like any other plugin. If activation fails, descriptive messages explain the reason for the failure and how to correct the problem.

There are entries for WP_CONFIG file,

REQUIRED:
define(‘WP_CACHE’,true);
define(‘WP_MEMCACHE_SERVERS’,’192.168.101.1,…’);
define(‘WP_MEMCACHE_PORT’,11211);

include(ABSPATH.’wp-content/plugins/wptruecache/config.php’);

OPTIONAL:
define(‘WP_MEMCACHE_FULL_SERVER_LIST’,’192.168.56.105,11211|172.19.47.180,23091’);
define(‘WP_TRUECACHE_COMPRESSION’,true); // turns on extra gzip compression*
define(‘WP_TRUECACHE_LOCK_TIMEOUT’,5); // sets a semaphore timeout*
define(‘WP_TRUECACHE_MEMCACHE_TIMEOUT’,30000);
define(‘WP_TRUECACHE_COMMENT_COOKIE_TIMEOUT’,(60*60*24));
define(‘WP_TRUECACHE_WAIT', 5 );
define(‘WP_TRUECACHE_NOCACHE_ITEMS’,’png|jpg|gif|js|feed|wp-login|wp-admin’);
define(‘WP_TRUECACHE_HEADERSTATS’,true);
define(‘WP_TRUECACHE_CACHEFLUSHALL’,true);
define(‘WP_TRUECACHE_TRACEON’, true);


The WP_CACHE=true setting tells wordpress to look for the advanced-cache.php file and invoke the wp_cache_postload function.

The WP_MEMCACHE_SERVERS specify the memcache server pool for the memcache distributed caching. This setting consists of a comma-delimited string of the memcache server ip addresses.

The WP_MEMCACHE_PORT=<port number> defines a global port variable for all memcache servers within the server pool. Used when the each memcache server in the cluster has the same port.

The WP_MEMCACHE_FULL_SERVER_LIST is an alternative method for defining the memcache server pool with the port. The server pool list is defined as a string delimited by the pipe (‘|’) to separate each host ip address/port number configuration, e.g. ‘host1,ip1|host2,ip2|host3,ip3’ IMPORTANT: If this setting is defined, will override the WP_MEMCACHE_SERVERS and WP_MEMCACHE_PORT settings.

When WP_TRUECACHE_COMPRESSION is set to true enables page compression before being displayed to the browser.

WP_TRUECACHE_LOCK TIMEOUT sets the expiration time for the memcached item semaphore.

WP_TRUECACHE_MEMCACHE_TIMEOUT sets the expiration time for a cached page.

WP_TRUECACHE_COMMENT_COOKIE_TIMEOUT sets the expiration for the infamous 357 day old cookie.

WP_TRUECACHE_WAIT sets the waiting time before a page reload attempt is made when the page is locked.

WP_TRUECACHE_NOCACHE_ITEMS overrides the items that should not be cached. Specify the list delimited by the pipe character (‘|’)

WP_TRUECACHE_HEADERSTATS will display the following stats in the header during a cache retrieval transaction:

WP_TRUECACHE_CACHEFLUSHALL will change the execution path when a page, post or a comment is being updated, then the entire memcache contents is flushed. This should not be set if memcache is being used for multiple domains, as the cache content for all domains will be discarded during a flushing operation.

WP_TRUECACHE_TRACEON will show memcache program path execution tracing in the response headers. This is usefully for quick live debugging to verify memcache operations are valid.

No further configuration operations are needed. The next time the page is loaded, the changes will be in effect.

IMPORTANT: TO TURN OFF THE WPTRUECACHE-HA, REMOVE THE WP-CACHE SETTING FROM WP-CONFIG FILE OR SET THE WP-CACHE SETTING TO FALSE. THIS TELLS WORDPRESS NOT TO LOAD THE ADVANCED-CACHE.PHP AND HENCE NOT INVOKE THE WP_CACHE_POSTLOAD FUNCTION.