wp-rocket
wp-rocket copied to clipboard
Same cache for loggedin and guest users
Hi there,
we ran a large WooCommerce shopping site and are very satisfied with the functionalities WP Rocket comes with.
Unfortunately there is no option to tell WP-Rocket that it should use the same cache for loggedin and guest users.
So we don't want to create separate cache files for loggedin users as you already can - we just want to tell WP Rocket to use the same cache files (that are preloaded) for guest and loggedin users. As WP Rocket correctly excludes the pages of WooCommerce that should not be cached this should work great and give some big advantages.
One must be careful, if the theme for example uses a static cart number to show the current number of items in the cart - so that number must be fetched via ajax - but except that it would perfectly fit our needs and I also think that this would be a great feature for other users.
So my idea is to have an option in the backend to trigger whether the same cache files should be used for loggedin and guest users - if this checkbox is checked another checkbox opens up with "exclude Administrators" from getting cached pages - so Administrators can still watch the Shop without cache.
I already tried the available plugins from here https://docs.wp-rocket.me/article/313-user-cache and https://docs.wp-rocket.me/article/919-disable-cache-for-logged-in-administrators But as said above - there is always a separate cache for loggedin and guest user,
A related ticket: https://secure.helpscout.net/conversation/1048787806/139666/
Another one: https://secure.helpscout.net/conversation/1151886362/161965?folderId=2135277
Another related ticket: https://secure.helpscout.net/conversation/1392141179/230154/
@vmanthos @Tabrisrp Can this be done by using a helper plugin?
@GeekPress This cannot be done using a helper plugin, as far as I understand.
Currently, we don't have a filter that we could use to do that, the way we have for the common cache for logged in users: https://github.com/wp-media/wp-rocket/blob/40ecc6c70de1995295a1994fb77a6ecb93885287/inc/functions/files.php#L78
That's used in the Cache
class to determine the path of the cached file we'll serve:
https://github.com/wp-media/wp-rocket/blob/355071c41725f399b0075cc9df5419aeb25cc3f3/inc/classes/Buffer/class-cache.php#L530
+1
Having the option to have a common cache for logged in visitors would be a great (for a WooCommerce site). There's simply no practical advantage of having a separate cache for each logged in user. In that scenario, pages are only cached when a user is logged in, so every page will take even longer time to load.. By the time the same user logged in and by chance visited the same product page, cache would be expired. Also not good for resources - having cache for 100s/1000s users for 100s of products would create a high server load and take a lot of space.
"Common Cache For Logged-in Users" wouldn't work in either, because if a shop manager is logged in before a random visitor, the visitor would then see shop managers (or admin's) cached version, so this approach is fundamentally flawed.
I think using the "public cache" for logged in user would be the best way forward. Swift Performance plugin has already implemented this feature successfully.
related: https://secure.helpscout.net/conversation/1478567372/254576?folderId=3864740
Hello. Is there any recent update? I have a WooCommerce store and find WP Rocket useful, but if you cannot preload the product pages for logged-in users (customers), I might have to switch to another caching plugin unfortunately...
Related request: https://secure.helpscout.net/conversation/1568992555/278868/
Another request https://secure.helpscout.net/conversation/1898866009/345291/
I have solved this issue by editing the advanced-cache.php
file and injecting a custom Cache
instance. This custom implementation removes the -loggedin-<random_hash>
from the cache file path. This way, everyone always gets served the guest cache files.
I have made this into a small helper plugin over here.
I made a simple snippet to make good use of the User Cache. Hope this can help you.
https://github.com/dgnerlab/unbreakable-user-permalink
Related request: https://secure.helpscout.net/conversation/2018545345/370625/
Related https://secure.helpscout.net/conversation/2003655862/367291/
Related: https://secure.helpscout.net/conversation/2063772281/380725/
Related: https://secure.helpscout.net/conversation/2066501274/381299?folderId=1213662
How can this not be addressed? If you have a very basic shop with absolutely no user content shown for logged-in users the guest cache should be sufficient for loggedin users, right?
Currently loggedin users on such sites just have a bad experience because the cache has to be build every time for the user which results to the exact same cached version as for the guest users.
4 years and still no solution to this?
@piotrbak Any update on this? On any large ecommerce store this is a problem - The uncached pages are too slow for general use on a particular site. Just trying to speed things up for my clients.
Related: https://secure.helpscout.net/conversation/2402778568/450786/
I just discovered the unviability of WP Rocket on large stores. I was creating a gameplan to take action
- Switch cart count to ajax with cacheable fragments (great)
- Disable automatic purging in WP Rocket, as products/categories were not cached - maybe for a few minutes. Users visiting the same pages created mutliple cache requests, which lead to WP Rocket causing a queue, just for it to delete the cached data 1 minute later.
- Cache logged in users. This is where I hit a brickwall. Not delivering the public cache to logged in users is not ideal. If you know what you're doing, the public cache would be super efficient to use instead.
Unfortuently i'd cancelled my license due to WP Rocket not being a great fit for high traffic WooCommerce stores
I solved the problem using nginx-rocket configuration.
At the nginx file default.conf, just commented the following lines:
" if ($http_cookie ~* "(wordpress_logged_in_|wp-postpass_|woocommerce_items_in_cart|woocommerce_cart_hash|wptouch_switch_toogle|comment_author_|comment_author_email_)") #{ set $rocket_bypass 0; set $rocket_is_bypassed "BYPASS"; set $rocket_reason "Cookie"; } "
During several months I have been running a shop store using one only cache to all users, logged-in and guests with relevant advantages in terms of performance.
However, with the wp-rocket release 3.16, the system its using separate mobile and desktop cache files.
Its great for optimization. However, since nginx-rocket does not fully work with separate mobile cache, you only need to disable mobile cache or adjust nginx-rocket config.
We could really use this feature - First requested almost 5 years ago?
The issue here is on huge or memory intensive sites where caching is required - It makes editing painful because the uncached version is extremely slow. This wont suit every site but it will massively benefit extremely large sites where editing speed suffers due to memory intensive processes and db lookups.
Please can we have an official update on this issue? I can see no one from WP-Rocket is assigned or checking this issue.
Related: https://secure.helpscout.net/conversation/2595496756/491116
Related: https://secure.helpscout.net/conversation/2595496756/491116
Thats not really helping, we can't see the conversation.
Another request: https://secure.helpscout.net/conversation/2601731785/492300/
Can someone please explain - Is helpscout an official WP-Rocket forum? If the answer is no - why are users reporting WP-Rocket issues on help scout and not reporting them here on the official github?
We are desperate for this feature - We have sites with extremely complex variable products where uncached has a stupendously long load time. By adding this feature it not only reduces php memory usage used by admins because requests made are cached like visitors and also improves the scalability of WP-Rocket as a viable caching solution as a site grows.