58
58
* @author Christoph Strobl
59
59
* @author Tugdual Grall
60
60
* @author Dengliming
61
+ * @author Mark John Moreno
61
62
* @since 2.2
62
63
*/
63
64
public interface ReactiveStreamCommands {
@@ -199,12 +200,14 @@ class AddStreamRecord extends KeyCommand {
199
200
200
201
private final ByteBufferRecord record ;
201
202
private final @ Nullable Long maxlen ;
203
+ private final boolean nomkstream ;
202
204
203
- private AddStreamRecord (ByteBufferRecord record , @ Nullable Long maxlen ) {
205
+ private AddStreamRecord (ByteBufferRecord record , @ Nullable Long maxlen , boolean nomkstream ) {
204
206
205
207
super (record .getStream ());
206
208
this .record = record ;
207
209
this .maxlen = maxlen ;
210
+ this .nomkstream = nomkstream ;
208
211
}
209
212
210
213
/**
@@ -217,7 +220,7 @@ public static AddStreamRecord of(ByteBufferRecord record) {
217
220
218
221
Assert .notNull (record , "Record must not be null!" );
219
222
220
- return new AddStreamRecord (record , null );
223
+ return new AddStreamRecord (record , null , false );
221
224
}
222
225
223
226
/**
@@ -230,7 +233,7 @@ public static AddStreamRecord body(Map<ByteBuffer, ByteBuffer> body) {
230
233
231
234
Assert .notNull (body , "Body must not be null!" );
232
235
233
- return new AddStreamRecord (StreamRecords .rawBuffer (body ), null );
236
+ return new AddStreamRecord (StreamRecords .rawBuffer (body ), null , false );
234
237
}
235
238
236
239
/**
@@ -240,7 +243,7 @@ public static AddStreamRecord body(Map<ByteBuffer, ByteBuffer> body) {
240
243
* @return a new {@link ReactiveGeoCommands.GeoAddCommand} with {@literal key} applied.
241
244
*/
242
245
public AddStreamRecord to (ByteBuffer key ) {
243
- return new AddStreamRecord (record .withStreamKey (key ), maxlen );
246
+ return new AddStreamRecord (record .withStreamKey (key ), maxlen , false );
244
247
}
245
248
246
249
/**
@@ -249,7 +252,28 @@ public AddStreamRecord to(ByteBuffer key) {
249
252
* @return new instance of {@link AddStreamRecord}.
250
253
*/
251
254
public AddStreamRecord maxlen (long maxlen ) {
252
- return new AddStreamRecord (record , maxlen );
255
+ return new AddStreamRecord (record , maxlen , false );
256
+ }
257
+
258
+ /**
259
+ * Disable creation of stream if it does not already exist.
260
+ *
261
+ * @return new instance of {@link AddStreamRecord}.
262
+ * @since 2.6
263
+ */
264
+ public AddStreamRecord makeNoStream () {
265
+ return new AddStreamRecord (record , maxlen , true );
266
+ }
267
+
268
+ /**
269
+ * Disable creation of stream if it does not already exist.
270
+ *
271
+ * @param makeNoStream {@code true} to not create a stream if it does not already exist.
272
+ * @return new instance of {@link AddStreamRecord}.
273
+ * @since 2.6
274
+ */
275
+ public AddStreamRecord makeNoStream (boolean makeNoStream ) {
276
+ return new AddStreamRecord (record , maxlen , makeNoStream );
253
277
}
254
278
255
279
/**
@@ -281,6 +305,14 @@ public Long getMaxlen() {
281
305
public boolean hasMaxlen () {
282
306
return maxlen != null && maxlen > 0 ;
283
307
}
308
+
309
+ /**
310
+ * @return {@literal true} if {@literal NOMKSTREAM} is set.
311
+ * @since 2.6
312
+ */
313
+ public boolean isNoMkStream () {
314
+ return nomkstream ;
315
+ }
284
316
}
285
317
286
318
/**
0 commit comments