@@ -57,6 +57,7 @@ public class DefaultSelect implements SelectFrom, Select {
57
57
private final Object limit ;
58
58
private final Object perPartitionLimit ;
59
59
private final boolean allowsFiltering ;
60
+ private final boolean bypassCache ;
60
61
private final Object timeout ;
61
62
62
63
public DefaultSelect (@ Nullable CqlIdentifier keyspace , @ NonNull CqlIdentifier table ) {
@@ -72,6 +73,7 @@ public DefaultSelect(@Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier ta
72
73
null ,
73
74
null ,
74
75
false ,
76
+ false ,
75
77
null );
76
78
}
77
79
@@ -94,6 +96,7 @@ public DefaultSelect(
94
96
@ Nullable Object limit ,
95
97
@ Nullable Object perPartitionLimit ,
96
98
boolean allowsFiltering ,
99
+ boolean bypassCache ,
97
100
@ Nullable Object timeout ) {
98
101
this .groupByClauses = groupByClauses ;
99
102
this .orderings = orderings ;
@@ -111,6 +114,7 @@ public DefaultSelect(
111
114
this .limit = limit ;
112
115
this .perPartitionLimit = perPartitionLimit ;
113
116
this .allowsFiltering = allowsFiltering ;
117
+ this .bypassCache = bypassCache ;
114
118
Preconditions .checkArgument (
115
119
timeout == null || timeout instanceof CqlDuration || timeout instanceof BindMarker ,
116
120
"TIMEOUT value must be a BindMarker or a CqlDuration" );
@@ -132,6 +136,7 @@ public SelectFrom json() {
132
136
limit ,
133
137
perPartitionLimit ,
134
138
allowsFiltering ,
139
+ bypassCache ,
135
140
timeout );
136
141
}
137
142
@@ -150,6 +155,7 @@ public SelectFrom distinct() {
150
155
limit ,
151
156
perPartitionLimit ,
152
157
allowsFiltering ,
158
+ bypassCache ,
153
159
timeout );
154
160
}
155
161
@@ -210,6 +216,7 @@ public Select withSelectors(@NonNull ImmutableList<Selector> newSelectors) {
210
216
limit ,
211
217
perPartitionLimit ,
212
218
allowsFiltering ,
219
+ bypassCache ,
213
220
timeout );
214
221
}
215
222
@@ -239,6 +246,7 @@ public Select withRelations(@NonNull ImmutableList<Relation> newRelations) {
239
246
limit ,
240
247
perPartitionLimit ,
241
248
allowsFiltering ,
249
+ bypassCache ,
242
250
timeout );
243
251
}
244
252
@@ -268,6 +276,7 @@ public Select withGroupByClauses(@NonNull ImmutableList<Selector> newGroupByClau
268
276
limit ,
269
277
perPartitionLimit ,
270
278
allowsFiltering ,
279
+ bypassCache ,
271
280
timeout );
272
281
}
273
282
@@ -297,6 +306,7 @@ public Select withOrderings(@NonNull ImmutableMap<CqlIdentifier, ClusteringOrder
297
306
limit ,
298
307
perPartitionLimit ,
299
308
allowsFiltering ,
309
+ bypassCache ,
300
310
timeout );
301
311
}
302
312
@@ -316,6 +326,7 @@ public Select limit(int limit) {
316
326
limit ,
317
327
perPartitionLimit ,
318
328
allowsFiltering ,
329
+ bypassCache ,
319
330
timeout );
320
331
}
321
332
@@ -334,6 +345,7 @@ public Select limit(@Nullable BindMarker bindMarker) {
334
345
bindMarker ,
335
346
perPartitionLimit ,
336
347
allowsFiltering ,
348
+ bypassCache ,
337
349
timeout );
338
350
}
339
351
@@ -354,6 +366,7 @@ public Select perPartitionLimit(int perPartitionLimit) {
354
366
limit ,
355
367
perPartitionLimit ,
356
368
allowsFiltering ,
369
+ bypassCache ,
357
370
timeout );
358
371
}
359
372
@@ -372,6 +385,7 @@ public Select perPartitionLimit(@Nullable BindMarker bindMarker) {
372
385
limit ,
373
386
bindMarker ,
374
387
allowsFiltering ,
388
+ bypassCache ,
375
389
timeout );
376
390
}
377
391
@@ -390,8 +404,29 @@ public Select allowFiltering() {
390
404
limit ,
391
405
perPartitionLimit ,
392
406
true ,
407
+ bypassCache ,
408
+ timeout );
409
+ }
410
+
411
+ @ NonNull
412
+ @ Override
413
+ public Select bypassCache () {
414
+ return new DefaultSelect (
415
+ keyspace ,
416
+ table ,
417
+ isJson ,
418
+ isDistinct ,
419
+ selectors ,
420
+ relations ,
421
+ groupByClauses ,
422
+ orderings ,
423
+ limit ,
424
+ perPartitionLimit ,
425
+ allowsFiltering ,
426
+ true ,
393
427
timeout );
394
428
}
429
+
395
430
@ NonNull
396
431
@ Override
397
432
public Select usingTimeout (@ NonNull final CqlDuration timeout ) {
@@ -407,6 +442,7 @@ public Select usingTimeout(@NonNull final CqlDuration timeout) {
407
442
limit ,
408
443
perPartitionLimit ,
409
444
allowsFiltering ,
445
+ bypassCache ,
410
446
timeout );
411
447
}
412
448
@@ -425,6 +461,7 @@ public Select usingTimeout(@NonNull BindMarker timeout) {
425
461
limit ,
426
462
perPartitionLimit ,
427
463
allowsFiltering ,
464
+ bypassCache ,
428
465
timeout );
429
466
}
430
467
@@ -482,6 +519,10 @@ public String asCql() {
482
519
builder .append (" ALLOW FILTERING" );
483
520
}
484
521
522
+ if (bypassCache ) {
523
+ builder .append (" BYPASS CACHE" );
524
+ }
525
+
485
526
if (timeout != null ) {
486
527
builder .append (" USING TIMEOUT " );
487
528
if (timeout instanceof BindMarker ) {
@@ -575,6 +616,10 @@ public boolean allowsFiltering() {
575
616
return allowsFiltering ;
576
617
}
577
618
619
+ public boolean bypassesCache () {
620
+ return bypassCache ;
621
+ }
622
+
578
623
@ Nullable
579
624
public Object getTimeout () {
580
625
return timeout ;
0 commit comments