Skip to content

Commit cf917c8

Browse files
committed
Address misleading documentation
Remove references that mention SHA-1 hashes being passed when evaluating server loaded Lua scripts. The current implementation passes the script itself instead of the hash, generated when the script was initially loaded, due to resiliency concerns.
1 parent 571d832 commit cf917c8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/Scripting.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ Any object that exposes field or property members with the same name as @-prefix
3535
- RedisKey
3636
- RedisValue
3737

38-
StackExchange.Redis handles Lua script caching internally. It automatically transmits the Lua script to redis on the first call to 'ScriptEvaluate'. For further calls of the same script only the hash with [`EVALSHA`](https://redis.io/commands/evalsha) is used.
38+
StackExchange.Redis handles Lua script caching internally. It automatically transmits the Lua script to redis on the first call to 'ScriptEvaluate'. For further calls of the same script [`EVAL`](https://redis.io/commands/eval) is used instead of [`EVALSHA`](https://redis.io/commands/evalsha), due to resiliency concerns.
3939

4040
For more control of the Lua script transmission to redis, `LuaScript` objects can be converted into `LoadedLuaScript`s via `LuaScript.Load(IServer)`.
41-
`LoadedLuaScripts` are evaluated with the [`EVALSHA`](https://redis.io/commands/evalsha), and referred to by hash.
41+
`LoadedLuaScripts` are evaluated with the [`EVAL`](https://redis.io/commands/eval) command instead of [`EVALSHA`](https://redis.io/commands/evalsha), due to resiliency concerns.
4242

4343
An example use of `LoadedLuaScript`:
4444

src/StackExchange.Redis/LuaScript.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public sealed class LoadedLuaScript
239239

240240
/// <summary>
241241
/// <para>The SHA1 hash of ExecutableScript.</para>
242-
/// <para>This is sent to Redis instead of ExecutableScript during Evaluate and EvaluateAsync calls.</para>
242+
/// <para>This is not sent to Redis, instead ExecutableScript is used during Evaluate and EvaluateAsync calls.</para>
243243
/// </summary>
244244
/// <remarks>Be aware that using hash directly is not resilient to Redis server restarts.</remarks>
245245
[EditorBrowsable(EditorBrowsableState.Never)]
@@ -257,8 +257,8 @@ internal LoadedLuaScript(LuaScript original, byte[] hash)
257257
/// <summary>
258258
/// <para>Evaluates this LoadedLuaScript against the given database, extracting parameters for the passed in object if any.</para>
259259
/// <para>
260-
/// This method sends the SHA1 hash of the ExecutableScript instead of the script itself.
261-
/// If the script has not been loaded into the passed Redis instance, it will fail.
260+
/// This method evaluates the script itself and does not send the SHA-1 hash, generated by the server when loaded initially, in order to execute it.
261+
/// If the script has not been loaded into the passed Redis instance, it will not fail.
262262
/// </para>
263263
/// </summary>
264264
/// <param name="db">The redis database to evaluate against.</param>
@@ -275,8 +275,8 @@ public RedisResult Evaluate(IDatabase db, object? ps = null, RedisKey? withKeyPr
275275
/// <summary>
276276
/// <para>Evaluates this LoadedLuaScript against the given database, extracting parameters for the passed in object if any.</para>
277277
/// <para>
278-
/// This method sends the SHA1 hash of the ExecutableScript instead of the script itself.
279-
/// If the script has not been loaded into the passed Redis instance, it will fail.
278+
/// This method evaluates the script itself and does not send the SHA-1 hash, generated by the server when loaded initially, in order to execute it.
279+
/// If the script has not been loaded into the passed Redis instance, it will not fail.
280280
/// </para>
281281
/// </summary>
282282
/// <param name="db">The redis database to evaluate against.</param>

0 commit comments

Comments
 (0)