@@ -113,7 +113,7 @@ Example shown below is for `glide-osx-aarch_64`.
113
113
dependencies {
114
114
testImplementation platform(' org.junit:junit-bom:5.10.0' )
115
115
testImplementation ' org.junit.jupiter:junit-jupiter'
116
- implementation group: ' software.amazon.glide' , name: ' glide-osx-aarch_64 ' , version: ' 0.4.2 '
116
+ implementation group: ' software.amazon.glide' , name: ' glide-for-redis ' , version: ' 0.4.3 '
117
117
}
118
118
```
119
119
@@ -133,72 +133,99 @@ Maven (AARCH_64) specific.
133
133
### Standalone Valkey:
134
134
135
135
``` java
136
+ // You can run this example code in the Main.
136
137
import glide.api.RedisClient ;
137
138
import glide.api.models.configuration.NodeAddress ;
138
139
import glide.api.models.configuration.RedisClientConfiguration ;
139
-
140
140
import java.util.concurrent.ExecutionException ;
141
+
141
142
import static glide.api.models.GlideString.gs ;
142
143
143
- // Run this code in the Main file. Include InterruptedException and ExecutionException handling.
144
+ public class Main {
144
145
145
- public static void main(String [] args) throws InterruptedException , ExecutionException {
146
+ public static void main (String [] args ) {
147
+ runGlideExamples();
148
+ }
146
149
147
- String host = " localhost" ;
148
- Integer port = 6379 ;
149
- boolean useSsl = false ;
150
+ private static void runGlideExamples () {
151
+ String host = " localhost" ;
152
+ Integer port = 6379 ;
153
+ boolean useSsl = false ;
150
154
151
- RedisClientConfiguration config =
152
- RedisClientConfiguration . builder()
153
- .address(NodeAddress . builder(). host(host). port(port). build())
154
- .useTLS(useSsl)
155
- .build();
155
+ RedisClientConfiguration config =
156
+ RedisClientConfiguration . builder()
157
+ .address(NodeAddress . builder(). host(host). port(port). build())
158
+ .useTLS(useSsl)
159
+ .build();
156
160
157
- RedisClient client = RedisClient . CreateClient(config). get();
161
+ try {
162
+ RedisClient client = RedisClient . CreateClient(config). get();
158
163
159
- System . out. println(" PING: " + client. ping(). get());
160
- System . out. println(" PING(found you): " + client. ping(" found you" ). get());
164
+ // TODO wait for this PR to get merged https://github.com/aws/glide-for-redis/pull/1663/ for PING to work.
165
+ System . out. println(" PING: " + client. ping(gs(" PING" )). get());
166
+ System . out. println(" PING(found you): " + client. ping( gs(" found you" )). get());
161
167
162
- System . out. println(" SET(apples, oranges): " + client. set(" apples" , " oranges" ). get());
163
- System . out. println(" GET(apples): " + client. get(" apples" ). get());
168
+ System . out. println(" SET(apples, oranges): " + client. set(gs( " apples" ), gs( " oranges" ) ). get());
169
+ System . out. println(" GET(apples): " + client. get(gs( " apples" ) ). get());
164
170
165
- System . out. println(" GLIDESTRINGSET(cats, meow): " + client. set(gs(" cats" ), gs(" meow" )). get());
166
- System . out. println(" GET(cats): " + client. get(" cats" ). get());
171
+ } catch (ExecutionException | InterruptedException e) {
172
+ System . out. println(" Glide example failed with an exception: " );
173
+ e. printStackTrace();
174
+ }
175
+ }
176
+ }
167
177
}
168
178
```
169
179
170
180
### Cluster Valkey:
171
181
``` java
172
-
173
182
import glide.api.RedisClusterClient ;
174
183
import glide.api.models.configuration.NodeAddress ;
175
184
import glide.api.models.configuration.RedisClusterClientConfiguration ;
185
+ import glide.api.models.configuration.RequestRoutingConfiguration ;
176
186
177
187
import java.util.concurrent.ExecutionException ;
178
- import static glide.api.models.GlideString.gs ;
179
-
180
- // Run this code in the Main file. Include InterruptedException and ExecutionException handling.
181
188
182
- String host = " localhost" ;
183
- Integer port = 6379 ;
184
- boolean useSsl = false ;
185
-
186
- RedisClusterClientConfiguration config =
187
- RedisClusterClientConfiguration . builder()
188
- .address(NodeAddress . builder(). host(host). port(port). build())
189
- .useTLS(useSsl)
190
- .build();
191
-
192
- RedisClusterClient client = RedisClusterClient . CreateClient(config). get();
193
-
194
- System . out. println(" PING: " + client. ping(). get());
195
- System . out. println(" PING(found you): " + client. ping(" found you" ). get());
196
-
197
- System . out. println(" SET(apples, oranges): " + client. set(" apples" , " oranges" ). get());
198
- System . out. println(" GET(apples): " + client. get(" apples" ). get());
189
+ import static glide.api.models.GlideString.gs ;
199
190
200
- System . out. println(" GLIDESTRINGSET(cats, meow): " + client. set(gs(" cats" ), gs(" meow" )). get());
201
- System . out. println(" GET(cats): " + client. get(" cats" ). get());
191
+ public class Main {
192
+
193
+ public static void main (String [] args ) {
194
+ runGlideExamples();
195
+ }
196
+
197
+ private static void runGlideExamples () {
198
+ String host = " localhost" ;
199
+ Integer port1 = 7001 ;
200
+ Integer port2 = 7002 ;
201
+ Integer port3 = 7003 ;
202
+ Integer port4 = 7004 ;
203
+ Integer port5 = 7005 ;
204
+ Integer port6 = 7006 ;
205
+ boolean useSsl = false ;
206
+
207
+ RedisClusterClientConfiguration config =
208
+ RedisClusterClientConfiguration . builder()
209
+ .address(NodeAddress . builder(). host(host). port(port1). port(port2). port(port3). port(port4). port(port5). port(port6). build())
210
+ .useTLS(useSsl)
211
+ .build();
212
+
213
+ try {
214
+ RedisClusterClient client = RedisClusterClient . CreateClient(config). get();
215
+
216
+ // TODO wait for this PR to get merged https://github.com/aws/glide-for-redis/pull/1663/ for PING to work.
217
+ System . out. println(" PING: " + client. ping(gs(" PING" )). get());
218
+ System . out. println(" PING(found you): " + client. ping( gs(" found you" )). get());
219
+
220
+ System . out. println(" SET(apples, oranges): " + client. set(gs(" apples" ), gs(" oranges" )). get());
221
+ System . out. println(" GET(apples): " + client. get(gs(" apples" )). get());
222
+
223
+ } catch (ExecutionException | InterruptedException e) {
224
+ System . out. println(" Glide example failed with an exception: " );
225
+ e. printStackTrace();
226
+ }
227
+ }
228
+ }
202
229
```
203
230
204
231
### Benchmarks
0 commit comments