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

chore: use getBatch/setbatch for mget/mset #31

Merged
merged 5 commits into from
Apr 22, 2024
Merged

Conversation

rishtigupta
Copy link
Contributor

@rishtigupta rishtigupta commented Apr 19, 2024

PR Description:

Follow-up PR for #29. This commit does the following:

  • Bumps the sdk version to latest (@v1.80.0)
  • Use getBatch/setbatch for mget/mset
  • Updates integ tests

Note

The Momento GetBatch operation returns a record or map containing only the keys for which values exist. It does not include keys that do not exist in the cache. Hence, validating the null case for Momento and Redis separately in the integ tests.

Issue:

https://github.com/momentohq/dev-eco-issue-tracker/issues/789

@rishtigupta rishtigupta marked this pull request as ready for review April 19, 2024 18:14
src/momento-redis-adapter.ts Show resolved Hide resolved
if (process.env.MOMENTO_ENABLED === 'true') {
expect(getResp).toEqual([value]);
} else {
expect(getResp).toEqual([value, null]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this feels wrong to me. I think we should be able to return the same result that redis does here. Can you help me understand why we can't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because GetBatch Response from sdk returns a map/record of keys and values for only the keys that exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

it also exposes a results function to get the raw results. But even with the map/record versions, you have the list of keys that they asked for, in the order that they asked for them, so you could just add nulls into the return value for anything that didn't show up in the map, right?

Copy link
Collaborator

@cprice404 cprice404 left a comment

Choose a reason for hiding this comment

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

left another question about the nulls

package.json Outdated Show resolved Hide resolved
@rishtigupta rishtigupta merged commit a8400a8 into main Apr 22, 2024
12 checks passed
@rishtigupta rishtigupta deleted the chore/update-mset-mget branch April 22, 2024 17:40
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.

2 participants