Quantcast
Channel: wp-super-cache – WordPress.org Forums
Viewing all articles
Browse latest Browse all 3480

Will on "[Plugin: WP Super Cache] Trying to get dynamic caching to work"

$
0
0

PHP Version 5.3.3
WP Version 3.9.2
Multisite enabled
WP Super Cache version 1.4.2

The following are checked:
- Use PHP to serve cache files
- Compress pages so they’re served more quickly to visitors
- Enable dynamic caching
- Mobile device support
- Late init
- Debugging enabled

We've been running WPSC successfully for a while. We're now trying to add dynamic content via the dynamic caching feature.

I am trying to get dynamic-cache-test.php to work and can't figure out what the issue is or where to look next.

It's a similar issue to this thread, but his solution (putting the plugin in the correct directory) doesn't work for me:
https://wordpress.org/support/topic/trying-to-understand-dynamic-cacheaction-filter

I've copied the latest code from the development version (http://svn.wp-plugins.org/wp-super-cache/trunk/plugins/dynamic-cache-test.php) and put it here:

/wp-content/plugins/wp-super-cache/plugins/dynamic-cache-test.php

In dynamic-cache-test.php, I modified:

define( 'DYNAMIC_CACHE_TEST_TAG', '' );

to:

define( 'DYNAMIC_CACHE_TEST_TAG', 'dynamiccachetesttag' );

I put the string dynamiccachetesttag in my WordPress theme. When I reload the page, it gets properly replaced by the string in dynamic_cache_test_filter(), which generates an HTML comment with a timestamp like it's supposed to. The WPSC debug log looks like this:

18:18:47 / Supercache Late Init: add wp_cache_serve_cache_file to init
18:18:47 / Supercache Late Loader running on init
18:18:47 / supercache dir: /wp-content/cache/supercache/test.ornith.cornell.edu/
18:18:47 / No Super Cache file found for current URL: /wp-content/cache/supercache/test.ornith.cornell.edu/index.html
18:18:47 / In WP Cache Phase 2
18:18:47 / Setting up WordPress actions
18:18:47 / Created output buffer
18:18:47 / Output buffer callback
18:18:47 / Anonymous user detected. Only creating Supercache file.
18:18:47 / wp_cache_check_mobile:
18:18:47 / Writing dynamic buffer to supercache file.
18:18:47 / Gzipping dynamic buffer for display.
18:18:47 / Renamed temp supercache file to /wp-content/cache/supercache/test.ornith.cornell.edu/index.html
18:18:47 / Writing gzip content headers. Sending buffer to browser
18:18:47 / wp_cache_shutdown_callback: collecting meta data.
18:18:47 / Did not write meta file: wp-cache-content08da6c719ee85298dbc3a287b8c33ea6.meta *1* *0* *1*

However, on subsequent page reloads, the filtering does not happen and 'dynamiccachetesttag' gets written to the page instead. It looks like the HTML is being served without being filtered. The WPSC debug log is unchanged. No new messages at all and no PHP errors or warnings. If I clear the WPSC cache and reload the page, dynamiccachetesttag is properly filtered again, but on subsequent reloads it reverts again.

If I'm logged into WordPress, dynamiccachetesttag is properly replaced each time. But that's probably because WPSC doesn't cache pages for known users. If I'm logged in, the debug log looks like this:

18:21:29 / Supercache Late Init: add wp_cache_serve_cache_file to init
18:21:30 / Supercache Late Loader running on init
18:21:30 / wp_cache_get_cookies_values: /^wp-postpass|^comment_author_|^wordpress_logged_in_d16342231d7d864148eaf519cddde342/ Cookie detected: wordpress_logged_in_d16342231d7d864148eaf519cddde342
18:21:30 / supercache dir: /wp-content/cache/supercache/test.ornith.cornell.edu/
18:21:30 / No Super Cache file found for current URL: /wp-content/cache/supercache/test.ornith.cornell.edu/index.html
18:21:30 / In WP Cache Phase 2
18:21:30 / Setting up WordPress actions
18:21:30 / Created output buffer
18:21:30 / Output buffer callback
18:21:30 / Anonymous user detected. Only creating Supercache file.
18:21:30 / wp_cache_get_cookies_values: /^wp-postpass|^comment_author_|^wordpress_logged_in_d16342231d7d864148eaf519cddde342/ Cookie detected: wordpress_logged_in_d16342231d7d864148eaf519cddde342
18:21:30 / Writing dynamic buffer to supercache file.
18:21:30 / Gzipping dynamic buffer for display.
18:21:30 / Writing gzip content headers. Sending buffer to browser
18:21:30 / wp_cache_shutdown_callback: collecting meta data.
18:21:30 / Did not write meta file: wp-cache-contenta5d9c81e594541ad1c435ec92259712e.meta *1* *0* *1*

I've tried everything I can think of to make this work. The only think I can see is the "Did not write meta file" message. Is this a normal message or something to try and fix?

Where should I look next?

Thanks,

- Will

https://wordpress.org/plugins/wp-super-cache/


Viewing all articles
Browse latest Browse all 3480

Trending Articles