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

Support 'FCALL' commands to Call Lua-scripts that are loaded as Function in redis #2185

Closed
sobhan-ssh opened this issue Aug 20, 2022 · 9 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@sobhan-ssh
Copy link

Support FCALL command, Redis 7 new feature

I wrote a Lua script, and loaded it as a function in my Redis using the below command:
cat updateJobAndForwardMsgScript.lua | redis-cli -x FUNCTION LOAD REPLACE

Then I was able to call my function in redis-cli as below:
FCALL updateJobAndForwardMsg 4 key1 key2 key3 key4 arg1

But when I wanted to implement it in my application using lettuce library I couldn't find any related method to support this new feature in Redis 7.

Here is the link to my StackOverFlow question, where I have described my problem more completly:
Calling loaded Redis functions using lettuce

It could be great if we could easily use this feature as below:
redisCommands.fcall("functionName", KeysNumber, Keys[], ARGS[]);

@mp911de mp911de added the type: enhancement A general enhancement label Aug 22, 2022
@shanul28
Copy link

shanul28 commented Oct 17, 2023

Hi,
Is there any update on the same? I'm also looking for a reactive way to make FCALL using my spring Webflux application

@shanul28
Copy link

Also, is there a need to implement FUNCTION LOAD command as well apart from FCALL?

@mp911de
Copy link
Collaborator

mp911de commented Oct 18, 2023

Any reason you do not define a command interface returning Mono or Flux?

@shanul28
Copy link

Let say if I define a new command, then I'll have to define it's execution flow as well by extending or overriding provided classes, I'm talking about making changes in my own project, not to the lettuce repo.

@shanul28
Copy link

Also let me know if there are any development on this redis function support in lettuce, I'm in need of this feature urgently

@mp911de
Copy link
Collaborator

mp911de commented Oct 18, 2023

I think we're currently not sharing the same understanding. I'm recommending (what the SO answer proposes as well) using Lettuce Command interfaces where you define an interface along with an annotated method, see https://lettuce.io/core/release/reference/index.html#command-interfaces.reactive the details for a reactive variant.

You don't need to override any Lettuce-specific methods or types, instead you define your method signature and Lettuce is going to implement it for you.

@shanul28
Copy link

so this way I will be able to create FUNCTION LOAD & FCALL command right? but still, I need to write logic on how function load will load the script into Redis, and return the library name. I want this all to happen in a reactive way. is there anything else I'll need to do apart from implementing the new command interface?

@mp911de mp911de added this to the 6.3 milestone Oct 18, 2023
@mp911de
Copy link
Collaborator

mp911de commented Oct 18, 2023

I created a bit of documentation at https://github.com/lettuce-io/lettuce-core/wiki/Scripting-and-Functions#leveraging-scripting-and-functions-through-command-interfaces.

Other than that, Lettuce 6.3 will ship with FCALL and FUNCTION commands.

mp911de added a commit that referenced this issue Oct 18, 2023
Support for FCALL and FUNCTION commands.
@mp911de mp911de closed this as completed Oct 18, 2023
@shanul28
Copy link

Thanks, Mark, When Can we expect the release of Lettuce 6.3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants