From 3d4a4de2e90ab07acea4b9e343062b56921dc8e6 Mon Sep 17 00:00:00 2001 From: Andy Stark Date: Tue, 21 Oct 2025 11:42:37 +0100 Subject: [PATCH 1/3] DOC-5838 added C# landing example notebooks --- .../client-specific/dotnet-async/AsyncLandingExample.cs | 1 + local_examples/client-specific/dotnet-sync/SyncLandingExample.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/local_examples/client-specific/dotnet-async/AsyncLandingExample.cs b/local_examples/client-specific/dotnet-async/AsyncLandingExample.cs index 77097dd7a..d8c34dff9 100644 --- a/local_examples/client-specific/dotnet-async/AsyncLandingExample.cs +++ b/local_examples/client-specific/dotnet-async/AsyncLandingExample.cs @@ -1,4 +1,5 @@ // EXAMPLE: landing +// BINDER_ID netasync-landing // STEP_START import using NRedisStack; using NRedisStack.RedisStackCommands; diff --git a/local_examples/client-specific/dotnet-sync/SyncLandingExample.cs b/local_examples/client-specific/dotnet-sync/SyncLandingExample.cs index 9428b9e5c..1bdf4aeb2 100644 --- a/local_examples/client-specific/dotnet-sync/SyncLandingExample.cs +++ b/local_examples/client-specific/dotnet-sync/SyncLandingExample.cs @@ -1,4 +1,5 @@ // EXAMPLE: landing +// BINDER_ID netsync-landing // STEP_START import using NRedisStack; using NRedisStack.RedisStackCommands; From 5422c13fc5a257b27709968b7df79c9d9131426f Mon Sep 17 00:00:00 2001 From: Andy Stark Date: Tue, 21 Oct 2025 14:02:34 +0100 Subject: [PATCH 2/3] DOC-5838 updated Jedis landing page example text --- content/develop/clients/jedis/_index.md | 39 ++++++++++--------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/content/develop/clients/jedis/_index.md b/content/develop/clients/jedis/_index.md index 733608f18..5dc5d3fe0 100644 --- a/content/develop/clients/jedis/_index.md +++ b/content/develop/clients/jedis/_index.md @@ -58,38 +58,31 @@ To include `Jedis` as a dependency in your application, edit the dependency file ## Connect and test -The following code opens a basic connection to a local Redis server -and closes it after use. +Add the following imports to your source file: -```java -package org.example; -import redis.clients.jedis.UnifiedJedis; +{{< clients-example set="landing" step="import" lang_filter="Java-Sync" >}} +{{< /clients-example >}} -public class Main { - public static void main(String[] args) { - UnifiedJedis jedis = new UnifiedJedis("redis://localhost:6379"); +Connect to localhost on port 6379: - // Code that interacts with Redis... - - jedis.close(); - } -} -``` +{{< clients-example set="landing" step="connect" lang_filter="Java-Sync" >}} +{{< /clients-example >}} After you have connected, you can check the connection by storing and -retrieving a simple string value: +retrieving a simple [string]({{< relref "/develop/data-types/strings" >}}) value: + +{{< clients-example set="landing" step="set_get_string" lang_filter="Java-Sync" >}} +{{< /clients-example >}} -```java -... +Store and retrieve a [hash]({{< relref "/develop/data-types/hashes" >}}): -String res1 = jedis.set("bike:1", "Deimos"); -System.out.println(res1); // OK +{{< clients-example set="landing" step="set_get_hash" lang_filter="Java-Sync" >}} +{{< /clients-example >}} -String res2 = jedis.get("bike:1"); -System.out.println(res2); // Deimos +Close the connection when you're done: -... -``` +{{< clients-example set="landing" step="close" lang_filter="Java-Sync" >}} +{{< /clients-example >}} ## More information From 19556cc9e9fad0e8e16c48b35550da0ba83f7465 Mon Sep 17 00:00:00 2001 From: Andy Stark Date: Tue, 21 Oct 2025 15:09:38 +0100 Subject: [PATCH 3/3] DOC-5838 updated Jedis landing example --- .../client-specific/jedis/LandingExample.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 local_examples/client-specific/jedis/LandingExample.java diff --git a/local_examples/client-specific/jedis/LandingExample.java b/local_examples/client-specific/jedis/LandingExample.java new file mode 100644 index 000000000..1df171f42 --- /dev/null +++ b/local_examples/client-specific/jedis/LandingExample.java @@ -0,0 +1,44 @@ +// EXAMPLE: landing +// BINDER_ID jedis-landing +// STEP_START import +import redis.clients.jedis.UnifiedJedis; +import java.util.HashMap; +import java.util.Map; +// STEP_END + +public class LandingExample { + + @Test + public void run() { + // STEP_START connect + UnifiedJedis jedis = new UnifiedJedis("redis://localhost:6379"); + // STEP_END + + // STEP_START set_get_string + String res1 = jedis.set("bike:1", "Deimos"); + System.out.println(res1); // >>> OK + + String res2 = jedis.get("bike:1"); + System.out.println(res2); // >>> Deimos + // STEP_END + + // STEP_START set_get_hash + Map hash = new HashMap<>(); + hash.put("name", "John"); + hash.put("surname", "Smith"); + hash.put("company", "Redis"); + hash.put("age", "29"); + + Long res3 = jedis.hset("user-session:123", hash); + System.out.println(res3); // >>> 4 + + Map res4 = jedis.hgetAll("user-session:123"); + System.out.println(res4); + // >>> {name=John, surname=Smith, company=Redis, age=29} + // STEP_END + + // STEP_START close + jedis.close(); + // STEP_END + } +}