Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear the cache of certain language will clear the whole cache in some cases #5590

Open
4 tasks
Mai-Saad opened this issue Nov 22, 2022 · 4 comments
Open
4 tasks
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: cache priority: low Issues that can wait severity: major Feature is not working as expected and no work around available type: bug Indicates an unexpected problem or unintended behavior

Comments

@Mai-Saad
Copy link

Mai-Saad commented Nov 22, 2022

Before submitting an issue please check that you’ve completed the following steps:

  • Made sure you’re on the latest version => 3.12.3.1
  • Used the search feature to ensure that the bug hasn’t been reported before

Describe the bug
Clearing the cache of one language will clear the whole cache

To Reproduce
Precondition:

  • WPML language format using qs i.e Language name added as a parameter (https://rocketlabsqa.ovh?lang=ar - Arabic)
  • Website has 3 languages
  • The shop page is set
    Steps to reproduce the behavior:
  1. Install and activate WPR
  2. Visit the Product and shop page in 3 different languages => pages are cached and completed in preload table
  3. Clear cache of 1 language i.e AR
  4. All cache was cleared

Expected behavior
Clear only affected language and not clear the whole cache

Screenshots
If applicable, add screenshots to help explain your problem.

Screencast.2022-11-22.09.46.21.mp4
Screencast.2022-11-22.09.46.21.mp4

Additional context
Add any other context about the problem here.

  • Same happened on 3.11.5
  • Sometimes, after step 3, the shop page gets unset automatically when we edit the product
  • Other setups for WPML shall be validated
  • WPML Version 4.5.8, WooCommerce Version 7.1.0, WCML Version 5.0.2

Backlog Grooming (for WP Media dev team use only)

  • Reproduce the problem
  • Identify the root cause
  • Scope a solution
  • Estimate the effort
@Mai-Saad Mai-Saad added type: bug Indicates an unexpected problem or unintended behavior 3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: cache priority: low Issues that can wait severity: major Feature is not working as expected and no work around available labels Nov 22, 2022
@vmanthos
Copy link
Contributor

We are ignoring query strings when clearing the cache and keep only the path:

foreach ( _rocket_get_cache_dirs( $parsed_url['host'], $cache_path ) as $dir ) {

So:

We will likely need to change how the cache is stored when $lang is used. For example:

  • cache/wp-rocket/example.com/#lang=el should store all the el URLs.
  • cache/wp-rocket/example.com/#lang=en should store all the en URLs, etc.

Things will be more complicated when more than one query string is used/cached, e.g. /about-us?lang=el&location=Greece.
In such a case, we could store the cache like this:

  • cache/wp-rocket/example.com/#lang=el/about-us#location=Greece

To make things worse there is inconsistent behavior depending on whether permalinks have a trailing / or not.
For /about-us?lang=el :

  • with a / we'll store its cache in a subfolder of the page to cache/wp-rocket/example.com/about-us/#lang=el
  • without a / the cache will be stored to: cache/wp-rocket/example.com/about-us#lang=el

This likely needs to be tackled as well.

@Mai-Saad
Copy link
Author

Mai-Saad commented Nov 22, 2022

Some exploratory test note(s) on the same env (may need new GH):
1- After a fresh install of WPR, language qs folders are fetched only for the home page by strange names (while Home is set to the latest posts or specific page), if we clear and preload the cache, it will be removed
=> on 3.12.3.1 and 3.12.2.1 but not on 3.11.5
Screenshot from 2022-11-22 13-15-50
2- Even on newlabs (without WPML), visiting URLs with in-progress status while a separate mobile cache is enabled, will result in completed status although no mobile version of the cache exists in the cache folder
3- Preload is not changing the status of paginated pages after editing any post inside it although, the edited post, home, and page folder were already deleted from the cache (not only prev/next pagination)

@Mai-Saad
Copy link
Author

on 3.15.2, Can see that clearing the cache of a specific language, will clear the whole cache except for this language (to the home page) and will change the language switch at admin to that specific language

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: cache priority: low Issues that can wait severity: major Feature is not working as expected and no work around available type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants