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

feat: add the unlink command #4

Merged
merged 2 commits into from
Aug 28, 2024
Merged

feat: add the unlink command #4

merged 2 commits into from
Aug 28, 2024

Conversation

malandis
Copy link
Collaborator

@malandis malandis commented Aug 26, 2024

Adds the Lettuce unlink command, which is similar to delete. Because the command takes variadic arguments, we fan out the delete requests. In the future we can hook up our rate limiting to this section.

@malandis malandis changed the base branch from main to feat/initial-implementation August 26, 2024 22:23
Comment on lines +1025 to +1028
var deleteFutures =
Arrays.stream(ks)
.map(k -> client.delete(cacheName, codec.encodeKeyToBytes(k)))
.collect(Collectors.toList());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because many Redis commands are variadic and batch oriented, we need to fan out to Momento.

Choose a reason for hiding this comment

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

this will have thread pool implications. We should extract this type of logic to a common helper function that we channel all of these types of batching operations through, so that we can add more explicit concurrency controls to it in the future if we need to. We don't need to solve the concurrency issues as part of this initial spike though.

Copy link

@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.

@nand4011 we may wanna pull you into this re: concurrency stuff at some point. For now I'd just like to abstract it to a single place so we can easily change the behavior later but if any specific concurrency issues come up your recent experience in the java sdk repo will be relevant.

Comment on lines +1025 to +1028
var deleteFutures =
Arrays.stream(ks)
.map(k -> client.delete(cacheName, codec.encodeKeyToBytes(k)))
.collect(Collectors.toList());

Choose a reason for hiding this comment

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

this will have thread pool implications. We should extract this type of logic to a common helper function that we channel all of these types of batching operations through, so that we can add more explicit concurrency controls to it in the future if we need to. We don't need to solve the concurrency issues as part of this initial spike though.

Base automatically changed from feat/initial-implementation to main August 28, 2024 20:00
Unlink is a Redis command similar to delete.
@malandis
Copy link
Collaborator Author

I rebased so no changes @cprice404 .

@rishtigupta or @nand4011 any comments about the future concurrency work?

@cprice404
Copy link

I rebased so no changes @cprice404 .

@rishtigupta or @nand4011 any comments about the future concurrency work?

You don't need to do it in this PR but before you perpetuate that .map pattern much further, I think it would be really good to just abstract a generic function to encapsulate it... like static List<Future<T>> issueConcurrentRequests<T>(...) and then put your calls to .map and .collect in there so that we only have to handle the concurrency changes in one place going forward

@malandis malandis merged commit ce9b724 into main Aug 28, 2024
2 checks passed
@malandis malandis deleted the feat/unlink branch August 28, 2024 22:01
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