EVAL_RO(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

✨ NAME ✨

eval_ro β€” executes a read-only server-side Lua script, and honestly? iconic behavior. πŸ’…

This lil page lives in the Valkey Command Manual, and yes bestie, eval_ro(3valkey) is the star of the show.


🌸 SYNOPSIS 🌸

EVAL_RO script numkeys key [key...]  arg [arg...]

(yes the spacing is exactly like that, don't come for me 🫢)


πŸ’– DESCRIPTION πŸ’–

okay so. This is the read-only variant of the EVAL command from valkey-eval(7). Same vibe, one big difference: it cannot execute commands that modify data. Nope. Not happening. The vibes are strictly observational. 🚫✨

Wanna know when you should reach for this one vs plain old EVAL? The details are over in the Read-only scripts section of valkey-programmability(7). Go read it, I'll wait. πŸ“š

And if you want the full lore drop on EVAL scripts in general, that's the Introduction to Eval Scripts section in valkey-eval-intro(7). It's giving "required reading". πŸŽ€


🫢 REPLY 🫢

The return value depends on the script that was executed. That's it, that's the whole reply. Whatever your script hands back is what you get. πŸ¦‹


πŸ”₯ COMPLEXITY πŸ”₯

Depends on the script that is executed. No cap, it's literally just the script's problem, not ours. πŸ’€


πŸ‘‘ ACL CATEGORIES πŸ‘‘

@scripting @slow


πŸ¦‹ HISTORY πŸ¦‹

  • Available since: 7.0.0 β€” she's been around, she's established, she's a main character. ⭐

πŸŽ€ EXAMPLES πŸŽ€

Watch this. First we set a key like normal:

> SET mykey "Hello"
OK

Then we run a read-only script that grabs it β€” and look at that, it works beautifully:

> EVAL_RO "return server.call('GET', KEYS[1])" 1 mykey
"Hello"

And now the part where the script tries to be messy and the server says absolutely not:

> EVAL_RO "return server.call('DEL', KEYS[1])" 1 mykey
(error) ERR Error running script (call to b0d697da25b13e49157b2c214a4033546aba2104): @user_script:1: @user_script: 1: Write commands are not allowed from read-only scripts.
bestie. Read the last line again. Write commands are not allowed from read-only scripts. That's the whole point of this command. DEL is a write command, so it gets vetoed. periodt. πŸš«πŸ’…

🌈 SEE ALSO 🌈

eval(3valkey), evalsha(3valkey), evalsha_ro(3valkey), fcall(3valkey), fcall_ro(3valkey), function(3valkey), function-delete(3valkey), function-dump(3valkey), function-flush(3valkey), function-help(3valkey), function-kill(3valkey), function-list(3valkey), function-load(3valkey), function-restore(3valkey), function-stats(3valkey), script(3valkey), script-debug(3valkey), script-exists(3valkey), script-flush(3valkey), script-help(3valkey), script-kill(3valkey), script-load(3valkey), script-show(3valkey)

(go read the whole family, they're all slaying in their own way πŸ§šπŸ’œ)


and that's the page!! πŸŽ€ This one's from Valkey 9.0.0, dated 2025-10-21, and yes β€” it really is the EVAL_RO(3valkey) manual page, just with way better energy. mwah. πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from