Support » Plugin: W3 Total Cache » w3tc page caching problems

  • Our site has an issue when the plugin W3TC ( version ) tries to get the cached page using memcached.

    The website is:
    and its Amazon hostname is:

    The DNS of is a CNAME Record configured as follow: CNAME

    W3Total Cache is configured to use the Memcached node:

    and in the “Page Cache” the Aliases are set to:

    We experiencing a problem when W3TC try to get the cached page from the memcached server.

    Viewing the comment at the bottom of the source page (home or internal page) seems that the page was correctly cached in memcached:

    <!– Performance optimized by W3 Total Cache. Learn more:
    Page Caching using memcache
    Content Delivery Network via
    Database Caching 52/479 queries in 0.280 seconds using memcache
    Served from: @ 2017-03-10 12:02:02 by W3 Total Cache –>
    Analysing the Graph of the memcached in Amazon Dashboard we saw that the items are growing up, there are new connection to the server so we assuming that the writing into the memcached server is ok.

    The issue appears when we reload the page just cached because the W3 Total Cache cannot find the cache version on memcached so it create again the cache and reload all the generation of the php with a slow time than the cached content.

    We verify that all the other features of W3TC are correctly working (CDN, Browser Cache, etc) and only the Page Cache feature is not working.

    We have tried to debug adding some logging to the code and we see the following warning:
    Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 11 in /var/www/html/wp-content/plugins/w3-total-cache/PgCache_ContentGrabber.php on line 759

    This function is supposed to verify if the url of the requested page is among those to be excluded from caching (as set by the admin in the WP backend).

    This is the code snippet which is generating the error preventing page caching from working on the given url:
    $reject_uri = $this->_config->get_array( ‘pgcache.reject.uri’ );
    $reject_uri = array_map( array( ‘\W3TC\Util_Environment’, ‘parse_path’ ), $reject_uri );
    foreach ( $reject_uri as $expr ) {
    $expr = trim( $expr );
    if ( $expr != ” && preg_match( ‘~’ . $expr . ‘~i’, $this->_request_uri ) ) {
    return false;
    The line with the call to preg_match was generating an errore and page caching was not used. We tried to bypass this error and then page caching works!

    With further debug we discovered that the problem is caused by the “$this->_request_uri” format which in some cases is not a normal string, but is appears as ASCII compressed code.

    What can we do?
    We cannot keep in production a “hacked” version of W3TC, but without our hack page caching does not work in a good % of cases (let’s say around 20% of page calls does not hit the cache if we do not modify the W3TC code)…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘w3tc page caching problems’ is closed to new replies.