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

Custom stored procedures with variable number of parameters #369

Merged
merged 6 commits into from
May 9, 2024

Conversation

badrishc
Copy link
Contributor

@badrishc badrishc commented May 8, 2024

Support custom commands (stored procedures) with a variable number of parameters. This can be used to implement commands such as a custom MSET variation that takes expiration as an argument.

Example of MSETPX is included in the PR here: https://github.com/microsoft/garnet/blob/ecbddd2c09b196cb19cdb67005f7ccc92192c214/main/GarnetServer/Extensions/MSetPx.cs

Example usage: set 5 key-values pairs with an expiration of 60 seconds (60000 milliseconds):

MSETPX 60000 key1 value1 key2 value2 key3 value3 key4 value4 key5 value5

image

Contributes to #366

… parameters. This can be used to implement commands such as a custom MSET with expiration. Example of MSETPX is included in the PR.
@badrishc
Copy link
Contributor Author

badrishc commented May 9, 2024

Added example for multi-get, where values match a specified prefix. Example:

127.0.0.1:3278> mset key1 com/value1 key2 org/value2 key3 edu/value3 key4 com/value4
OK
127.0.0.1:3278> mgetifpm com key1 key2 key3 key4
1) "key1"
2) "com/value1"
3) "key4"
4) "com/value4"

Stored proc is here: main/GarnetServer/Extensions/MGetIfPM.cs

@badrishc badrishc merged commit 8a1d5f8 into main May 9, 2024
23 checks passed
@badrishc badrishc deleted the badrishc/custom-txn-variable-params branch May 9, 2024 20:44
@github-actions github-actions bot locked and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants