Skip to content

add ReadOnlyMemory<RedisKeyOrValue> and Lease<byte> for Lua and Execute - #3201

Open
pairbit wants to merge 10 commits into
StackExchange:mainfrom
pairbit:lua-memory-pr
Open

add ReadOnlyMemory<RedisKeyOrValue> and Lease<byte> for Lua and Execute#3201
pairbit wants to merge 10 commits into
StackExchange:mainfrom
pairbit:lua-memory-pr

Conversation

@pairbit

@pairbit pairbit commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Tasks:

  • add ReadOnlyMemory<RedisKeyOrValue> API for Lua
  • add Lease<byte>? API for Lua
  • add ScriptEvaluateReadOnlyAsync again if the script does not exist.
  • add rent args for key-prefix path
  • add ReadOnlyMemory<RedisKeyOrValue> API for Execute
  • add Lease<byte>? API for Execute
  • add IScriptRequestDisposer to Execute (to return memory to pools, including for fire-and-forget mode)

Links
#2346
#2843
#2844

Please consider this PR, this issue has been raised for a long time

* add RedisKeyOrValue

* add operators and override to RedisKeyOrValue

* add ThrowInvalidCast

* add IScriptRequestDisposer

* ScriptEvaluateMemory

* ScriptEvaluateMemoryReadOnlyAsync

* ScriptEvalMemoryMessage

* fix bug ScriptUnavailable ScriptEvaluateReadOnlyAsync

* add Lease ScriptEvaluateMemory

* add Prefixed

* FromKey FromValue

* undo Disposer
@pairbit pairbit changed the title add ReadOnlyMemory<RedisKeyOrValue> and Lease<byte> for Lua add ReadOnlyMemory<RedisKeyOrValue> and Lease<byte> for Lua and Execute Aug 31, 2026
@mgravell

Copy link
Copy Markdown
Collaborator

There's a couple of reasons I've been deferring on this for a little bit...

If we're thinking "efficiency", there's the problem of the return value, and managing it in a way that is flexible and efficient.

I'm not quite ready to release it on the world yet, but a large part of the IO rewrite is "yet to come", and explicitly targets flexible read / write custom command scenarios, including Lua (but also any ad-hoc commands). I'm torn between compromising on an eval[sha] now, bs giving you the real thing "soon" - trust me, it'll be much easier than this.

Thoughts?

@pairbit

pairbit commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

I understand that you want to give the maximum. But the perfect is the enemy of the good. The solution I propose will completely satisfy many and will be a compromise. For most tasks, the current solution will be sufficient. But I understand it's not perfect.

I'd really appreciate your consideration of my merge request. It's a good temporary compromise.

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