StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

add support for EVAL[SHA]_RO via new CommandFlags.ReadOnly

Open mgravell opened this issue 2 years ago • 2 comments

mgravell avatar Aug 02 '22 10:08 mgravell

For call today: note this interacts a bit with #2191, but I'm thinking this is a bit odd in a top level view at least with how other commands currently behave: "use read-only if we can" internally - should chat on how we want this to look at the top level and maybe apply to SORT_RO the same? It's an odd case, but wonder if we can handle one way - doing this at the server selection phase maybe does make more sense overall rather than adding more commands for sure.

NickCraver avatar Aug 02 '22 13:08 NickCraver

@NickCraver - worth noting that eval/evalsha is a weird case. Unless you want to add a lot of intelligence to the lua parser in the library, there's not going to be a good way to know ahead of time whether or not the command is in fact RO, so abstracting it from the user is impractical. In the case of SORT vs SORT_RO, for example, we know if it's going to be readonly or not based on the presence of a destination key.

My two cents on this, I kinda think this might be the case where you might want to either add new EvalRO & EvalShaRO methods to IDatabase OR add a read-only setting to the LuaScript class and use that to determine whether it would be readonly or not. Personally, I think I'd lean towards the latter. The extra command flag might get confusing, especially if it doesn't end up getting applied consistently.

slorello89 avatar Aug 02 '22 13:08 slorello89

Since we ended up going the #2168 route - cleaning up!

NickCraver avatar Jan 04 '23 15:01 NickCraver