Hi Richard,
Thanks for the quick reply. I tried very hard to word everything properly, but if you struggle to understand anything please let me know and I’ll adjust. I tested everything to the best that I can to document everything. Everything is tested using postman on a local up to date WP environment.
?First issue
Regarding the WP core endpoint, I tested it and compared to the WC endpoint. Both endpoints have the same object type (comment). Woocommerce reviews are the same as normal comments except they have a few extra fields and are tied to a specific post type.
The two endpoints I tested are:
/wp-json/wp/v2/comments?/
/wp-json/wc/v3/products/reviews?page=1&per_page=100?
Here is what I learned.
- Deleting a regular comment on a post triggers the wp/v2/comments URI to flush. It does not trigger the WC reviews URI to flush.
- Restoring that regular comment (that I deleted) from the trash back to the comments causes both the WP and the WC URI to flush.
- Deleting a review on a product, specifically a WC review, does not flush the URIs.
- Restoring that review DOES flush both URIs
I will see if I can find time to investigate the source code of the cache plugin and WC and compare and see why reviews are acting up.
Second issue
I am testing all of the below with: /wp-json/wp/v2/comments?
Regarding flushing / deleting, I am just thoroughly confused and it might be because of a bug. When I delete a record from that table or flush a cache, i start to get mixed results. Sometimes the cached records hit and sometimes they don’t.
When flushing, specifically, the following happens:?
- Active columns turns to an X
-
Expiration = Flushed
?When I call the API from here, I have 2 different outcomes. When I first call it, the call takes a long time and there are no table changes. If I call it immediately after, the # Cache Hits increases by 1 and the call loads the cached result. If I wait a little bit then try again, it goes back to taking a long time. Spamming the send button essentially causes it to cache.
?I tested further by editing a comment which normally triggers the cache to tell the API to fetch new content. This made no difference to the flushed record and it still behaves the weird way I illustrated above.
The only way I am able to get out of this is clicking the Clear REST cache button in the WPAdmin bar. Then, when I call the API, the record loads as intended and Active has the green checkmark and the API calls ALWAYS return the cached result. I was curious what happens in the table when I modify a comment when everything works perfectly, and the table switched to say Flushed and the red X appeared. Yet unlike before, calling the API switched it back to caching properly.
I can help you debug this further if you’d like proof or access to my environment for debugging purposes.`
-
This reply was modified 3 years, 4 months ago by
jacobraccuia.