• Resolved kds26

    (@kds26)


    Hi, I am wondering if you know of a way that I can create a different cache for logged in users similar to how WP Rocket does. I have retail and wholesale customers so their would need to be a different cache per user, I think that is how WP Rocket works too. Any ideas would be appreciated, just looking for a way to speed up my site for logged in users. Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • +1

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @kds26 & @ofmarconi,
    I am really sorry to say but this is never will be possible. I honestly don’t care about what other plugins are claiming to do, but what you are asking is just technically impossible.

    It seems you don’t understand how caching works in the first place. When you have no caching on a site and you access a page, that request goes to your origin server and it then executes all the PHP codes, all the logic, everything to generate the HTML that is sent back to you.

    So, as you can understand that this process takes time to execute all the PHP codes and complex logic. But if you think deeply, then you will quickly realize that these dynamic nature is not needed for most normal (non-loggedin) users as the pages, posts, contents that they see on the website as a normal user, mostly never changes and remains static.

    This is where caching comes into play. With caching, the first request gets generated by PHP like it usually does but from then on the caching system copies the HTML generated and keeps it saved. So, all the further requests never reaches PHP core to bigin with and instantly returned the generated HTML that was saved.

    Now when a loggedin user comes into the picture, they might perform different actions which might needs to be intercepted by PHP and then dynamically execute the code to show the content. So, how these requests can be cached? Loggedin user behaviour are always unpredictable and at any point they can do something that will request PHP to intercept that request and execute logics.

    Hence, loggedin user requests will never be cached and will always be bypassed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cache for logged in users’ is closed to new replies.