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

Use Buffers for cache records #26699

Closed
zharinov opened this issue Jan 17, 2024 · 6 comments · Fixed by #29977
Closed

Use Buffers for cache records #26699

zharinov opened this issue Jan 17, 2024 · 6 comments · Fixed by #29977
Assignees
Labels
core:cache priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:refactor Refactoring or improving of existing code

Comments

@zharinov
Copy link
Collaborator

Describe the proposed change(s).

Encoding to base64 was a bad idea, because it slows down cache writes about twice.
Instead, we have to do JSON.stringify, compress it into a Buffer and then pass it directly to Redis or Cacache.

@zharinov zharinov added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:refactor Refactoring or improving of existing code core:cache labels Jan 17, 2024
@zharinov zharinov self-assigned this Jan 17, 2024
@zharinov
Copy link
Collaborator Author

Since new format is incompatible, we need to use different cache keys.
In order to reuse older cache records until they're expired, let's fallback to the older cache key during cache get operations.

@rarkins
Copy link
Collaborator

rarkins commented Jan 17, 2024

We can't detect it based on the payload or some other heuristic?

@viceice
Copy link
Member

viceice commented Jan 17, 2024

don't we've a cache version? 🤔 we previously used that.

can we use some magic bytes at buffer start to detect version?

@zharinov
Copy link
Collaborator Author

zharinov commented Jan 17, 2024

don't we've a cache version? 🤔 we previously used that.

It's repository cache concept and it is located inside JSON which is not yet decoded at the moment of Buffer vs base64 decision

@viceice
Copy link
Member

viceice commented Jan 17, 2024

what if we simply try to decode the new way and fallback to old way when failed?

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 37.421.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
core:cache priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:refactor Refactoring or improving of existing code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants