Skip to main content

Module script

Module script 

Source
Expand description

Lua script helper (Script): SHA-caching EVALSHA with EVAL fallback.

use glide::Script;
let script = Script::new("return tonumber(ARGV[1]) + tonumber(ARGV[2])");
let sum: i64 = script.arg(1).arg(2).invoke_async(&mut client).await?;
assert_eq!(sum, 3);

Async methods take an async GLIDE client (crate::GlideClient or crate::GlideClusterClient); blocking methods take a sync GLIDE client (crate::sync::SyncGlideClient or crate::sync::SyncGlideClusterClient).

Structs§

Script
A cached Lua script with its SHA-1 hash.
ScriptInvocation
A pending script invocation: keys + args bound to a Script.