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

fix(javascript): enable cache #612

Merged
merged 2 commits into from
May 31, 2022
Merged

fix(javascript): enable cache #612

merged 2 commits into from
May 31, 2022

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented May 31, 2022

🧭 What and Why

cacheable is already a key in the transporter's Request interface, but no method actually set it before now

🎟 JIRA Ticket: APIC-503

Changes included:

  • set cacheable: true in the mustache for JS if in the yaml
  • set x-cacheable to the cacheable requests (same as "useReadTransporter")

🧪 Test

search no longer does two requests if you do it twice (in combination with #611

cacheable is already a key in the transporter's Request interface, but no method actually set it before now
@Haroenv Haroenv requested a review from millotp May 31, 2022 09:03
@netlify
Copy link

netlify bot commented May 31, 2022

Deploy Preview for api-clients-automation ready!

Name Link
🔨 Latest commit 925f936
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/6295d9f2463d9e0008ce1860
😎 Deploy Preview https://deploy-preview-612--api-clients-automation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@algolia-bot
Copy link
Collaborator

algolia-bot commented May 31, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

@Haroenv Haroenv marked this pull request as ready for review May 31, 2022 09:17
@Haroenv Haroenv requested a review from bodinsamuel May 31, 2022 09:18
Copy link
Collaborator

@millotp millotp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So fast ! thank you !
What do you use to determine if a requests is cacheable or not ? Do we have a list somewhere ?

@Haroenv
Copy link
Contributor Author

Haroenv commented May 31, 2022

I used the same list as the ones that have "useReadTransporter", which are all POST. Not sure if the other GET ones should be cached as well, you can compare with v4 here: https://github.com/algolia/algoliasearch-client-javascript/search?q=cacheable%3A+true

@Haroenv
Copy link
Contributor Author

Haroenv commented May 31, 2022

I'd say it's only urgent for the requests commonly used frontend (search, recommend)

Base automatically changed from fix/cache-on-get to main May 31, 2022 09:52
@millotp millotp merged commit b62b861 into main May 31, 2022
@millotp millotp deleted the fix/enable-cache branch May 31, 2022 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants