• Resolved GeddeDev

    (@ggedde)


    I enabled the setting “Enable caching for all visitors” however, each user is getting a different cached file. I am assuming you are doing this on purpose in case there is specific user data shown, but I don’t need that. I am looking for a way for the cached file to be the same for all users. Is there a way to enable this.

    Alternatively, I thought I could just set “Make known users anonymous so they’re served supercached static files”, but that does not work as expected as I do not have access to any user functions with that enabled.

    Is there another way to achieve this?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter GeddeDev

    (@ggedde)

    Looks like in order to get this to work you need to first enable “Late init. Display cached files after WordPress has loaded.” then add a add_cacheaction to the wp_cache_get_cookies_values.
    Example

    add_cacheaction(
    	'wp_cache_get_cookies_values',
    	function( $value ) {
    		return 'some_value_here';
    	}
    );

    You can add your own conditions etc, but the caching is a little slower because of the Late Init.

    Plugin Contributor Mike Stott

    (@mikemayhem3030)

    Hi @ggedde

    Thanks for sharing your solution! I’m going to mark this as resolved but do let us know if you still have issues.

    Mike

    @ggedde – you know that all your logged in users will see the same “personal” information if you do this? So if you display their username or name it will show the username or name of the first person to cause a page to be cached? This also applies to other things like leaving comments on pages, or making purchases in a shop if you have one.

    Full page caching doesn’t work very well on a site with logged in users as you’ve discovered. You’re better off caching the expensive parts of your sites with something like memcache.

    However, if your users aren’t logged in, but the plugin is generating different cache pages because of a cookie you might be able to use the “Rejected Cookies” setting to ignore certain cookies.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Why are different users served different cached files?’ is closed to new replies.