From 8fe72a0840777c0c6aa0404c0ea9699251ddf593 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 10 Oct 2024 14:30:05 +0200 Subject: [PATCH] Fix Scripting Documentation for imperative Lua scripts. See #3010 --- .../modules/ROOT/pages/redis/scripting.adoc | 2 +- .../core/script/ReactiveScriptExecutor.java | 16 ++++++------- .../redis/core/script/ScriptExecutor.java | 24 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/redis/scripting.adoc b/src/main/antora/modules/ROOT/pages/redis/scripting.adoc index 436c50d11..bb2766b44 100644 --- a/src/main/antora/modules/ROOT/pages/redis/scripting.adoc +++ b/src/main/antora/modules/ROOT/pages/redis/scripting.adoc @@ -34,7 +34,7 @@ public class Example { RedisScript script; public boolean checkAndSet(String expectedValue, String newValue) { - return redisOperations.execute(script, singletonList("key"), asList(expectedValue, newValue)); + return redisOperations.execute(script, singletonList("key"), expectedValue, newValue); } } ---- diff --git a/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java index b9b765d96..7af46ee27 100644 --- a/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java +++ b/src/main/java/org/springframework/data/redis/core/script/ReactiveScriptExecutor.java @@ -30,8 +30,8 @@ import org.springframework.data.redis.serializer.RedisSerializer; *

* Streams of methods returning {@code Mono} or {@code Flux} are terminated with * {@link org.springframework.dao.InvalidDataAccessApiUsageException} when - * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@code null} for a - * particular element as Reactive Streams prohibit the usage of {@code null} values. + * {@link org.springframework.data.redis.serializer.RedisElementReader#read(ByteBuffer)} returns {@literal null} for a + * particular element as Reactive Streams prohibit the usage of {@literal null} values. * * @author Mark Paluch * @author Christoph Strobl @@ -45,7 +45,7 @@ public interface ReactiveScriptExecutor { * * @param script must not be {@literal null}. * @return the return value of the script or {@link Flux#empty()} if {@link RedisScript#getResultType()} is - * {@literal null}, likely indicating a throw-away status reply (i.e. "OK") + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ default Flux execute(RedisScript script) { return execute(script, Collections.emptyList()); @@ -57,7 +57,7 @@ public interface ReactiveScriptExecutor { * @param script must not be {@literal null}. * @param keys must not be {@literal null}. * @return the return value of the script or {@link Flux#empty()} if {@link RedisScript#getResultType()} is - * {@literal null}, likely indicating a throw-away status reply (i.e. "OK") + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ default Flux execute(RedisScript script, List keys) { return execute(script, keys, Collections.emptyList()); @@ -67,8 +67,8 @@ public interface ReactiveScriptExecutor { * Executes the given {@link RedisScript} * * @param script The script to execute. Must not be {@literal null}. - * @param keys Any keys that need to be passed to the script. Must not be {@literal null}. - * @param args Any args that need to be passed to the script. Can be {@literal empty}. + * @param keys any keys that need to be passed to the script. Must not be {@literal null}. + * @param args any args that need to be passed to the script. Can be {@literal empty}. * @return The return value of the script or {@link Flux#empty()} if {@link RedisScript#getResultType()} is * {@literal null}, likely indicating a throw-away status reply (i.e. "OK") */ @@ -79,8 +79,8 @@ public interface ReactiveScriptExecutor { * arguments and result. * * @param script The script to execute. must not be {@literal null}. - * @param keys Any keys that need to be passed to the script - * @param args Any args that need to be passed to the script + * @param keys any keys that need to be passed to the script. + * @param args any args that need to be passed to the script. * @param argsWriter The {@link RedisElementWriter} to use for serializing args. Must not be {@literal null}. * @param resultReader The {@link RedisElementReader} to use for serializing the script return value. Must not be * {@literal null}. diff --git a/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.java b/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.java index b7b658a7e..f9c950a2d 100644 --- a/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.java +++ b/src/main/java/org/springframework/data/redis/core/script/ScriptExecutor.java @@ -30,11 +30,11 @@ public interface ScriptExecutor { /** * Executes the given {@link RedisScript} * - * @param script The script to execute - * @param keys Any keys that need to be passed to the script - * @param args Any args that need to be passed to the script - * @return The return value of the script or null if {@link RedisScript#getResultType()} is null, likely indicating a - * throw-away status reply (i.e. "OK") + * @param script the script to execute. + * @param keys any keys that need to be passed to the script. + * @param args any args that need to be passed to the script. + * @return The return value of the script or {@literal null} if {@link RedisScript#getResultType()} is + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ T execute(RedisScript script, List keys, Object... args); @@ -42,13 +42,13 @@ public interface ScriptExecutor { * Executes the given {@link RedisScript}, using the provided {@link RedisSerializer}s to serialize the script * arguments and result. * - * @param script The script to execute - * @param argsSerializer The {@link RedisSerializer} to use for serializing args - * @param resultSerializer The {@link RedisSerializer} to use for serializing the script return value - * @param keys Any keys that need to be passed to the script - * @param args Any args that need to be passed to the script - * @return The return value of the script or null if {@link RedisScript#getResultType()} is null, likely indicating a - * throw-away status reply (i.e. "OK") + * @param script the script to execute. + * @param argsSerializer The {@link RedisSerializer} to use for serializing args. + * @param resultSerializer The {@link RedisSerializer} to use for serializing the script return value. + * @param keys any keys that need to be passed to the script. + * @param args any args that need to be passed to the script. + * @return The return value of the script or {@literal null} if {@link RedisScript#getResultType()} is + * {@literal null}, likely indicating a throw-away status reply (i.e. "OK"). */ T execute(RedisScript script, RedisSerializer argsSerializer, RedisSerializer resultSerializer, List keys, Object... args);