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

Set cache id prefix on installation #18641

Merged
merged 4 commits into from
Nov 22, 2018
Merged

Set cache id prefix on installation #18641

merged 4 commits into from
Nov 22, 2018

Conversation

schmengler
Copy link
Contributor

@schmengler schmengler commented Oct 16, 2018

Description (*)

The undocumented id_prefix option for the cache frontend is used to prefix cache keys. If it is not set, Magento uses the first 12 bits of the md5 hash of the absolute path to Magentos app/etc directory. But if this is not exactly the same on all web servers, cache invalidation does not work.

Source: https://github.com/magento/magento2/blob/2.3-develop/lib/internal/Magento/Framework/App/Cache/Frontend/Factory.php#L121-L130

To prevent this issue, the value shall be set on installation, so that the fall back on the fly does not happen anymore. Optionally, the value can be specified explicitly.

Fixed Issues (if relevant)

  1. Multisite installation, default website slow (X-Magento-Vary) #15828: Multisite installation, default website slow

Manual testing scenarios (*)

  1. Install Magento via CLI or Web Wizard
  2. There should be new options "cache-id-prefix" and "page-cache-id-prefix"
  3. The value is saved in env.php at cache/frontend/{default,page_cache}/id_prefix

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Oct 16, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @schmengler. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@schmengler
Copy link
Contributor Author

To be discussed: what if the behavior to have a cache prefix based on installation dir is desired? This can be the case if a cache for an old release should coexist with a cache for a new release which gets pre-warmed before switching

@phoenix128 phoenix128 assigned phoenix128 and unassigned phoenix128 Oct 24, 2018
@slavvka
Copy link
Member

slavvka commented Oct 26, 2018

Hey @schmengler Thank you for the contribution. It is really a good improvement. The case with pre-warming also fits it since we may decide whether it is generated or set by a user.

@slavvka
Copy link
Member

slavvka commented Nov 14, 2018

Hey @schmengler GitHub show that you didn't sign up the CLA. Could you do that following the link?

@schmengler
Copy link
Contributor Author

@slavvka Oh, apparently there's a new CLA that I did not sign yet, did it now!

@magento-engcom-team
Copy link
Contributor

Hi @schmengler. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants