forked from valkey-io/valkey-glide-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalkey_glide_commands_common.h
More file actions
1323 lines (1215 loc) · 90.8 KB
/
valkey_glide_commands_common.h
File metadata and controls
1323 lines (1215 loc) · 90.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
+----------------------------------------------------------------------+
| Valkey Glide Commands Common Framework |
+----------------------------------------------------------------------+
| Copyright (c) 2023-2025 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef VALKEY_GLIDE_COMMANDS_COMMON_H
#define VALKEY_GLIDE_COMMANDS_COMMON_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "common.h"
#include "include/glide/connection_request.pb-c.h"
#include "include/glide_bindings.h"
/* Forward declarations for types defined in glide_bindings.h */
typedef struct CommandResponse CommandResponse;
typedef struct CommandResult CommandResult;
typedef struct CommandError CommandError;
typedef struct ConnectionResponse ConnectionResponse;
enum TLSMode {
/**
* No TLS encryption is used for the connection.
*/
NoTLS = 0,
/**
* TLS encryption is used for the connection with certificate verification.
*/
SecureTLS = 1,
/**
* TLS encryption is used for the connection without certificate verification.
*/
InsecureTLS = 2,
};
/* ClientConfig removed - using valkey_glide_client_configuration_t instead */
/* Forward declaration for ClientAdapter */
typedef struct ClientAdapter ClientAdapter;
/* Function to close a Valkey Glide client */
void close_glide_client(const void* glide_client);
void free_command_response(CommandResponse* command_response_ptr);
void free_command_result(CommandResult* command_result_ptr);
/* Helper functions for Valkey Glide integration */
const ConnectionResponse* create_glide_client(valkey_glide_base_client_configuration_t* config);
const ConnectionResponse* create_glide_cluster_client(
valkey_glide_cluster_client_configuration_t* config);
/* Return the protobuf message representing the connection request. Caller must free the result with
* efree() */
uint8_t* create_connection_request(const char* host,
int port,
size_t* len,
valkey_glide_base_client_configuration_t* config,
valkey_glide_periodic_checks_status_t periodic_checks,
bool is_cluster,
bool refresh_topology_from_initial_nodes);
/* Bit operations - UNIFIED SIGNATURES */
int execute_bitcount_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_bitop_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_bitpos_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* String operations */
int execute_set_command_internal(valkey_glide_object* valkey_glide,
const char* key,
size_t key_len,
const char* val,
size_t val_len,
long expire,
zval* opts,
char** old_val,
size_t* old_val_len,
zval* return_value);
int execute_set_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_setex_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_psetex_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_setnx_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_get_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* Key operations */
int execute_randomkey_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* Server operations */
int execute_echo_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_ping_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_reset_command(const void* glide_client);
int execute_info_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* Additional operations */
int execute_getbit_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_setbit_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_del_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_del_array(const void* glide_client,
HashTable* keys_hash,
long* output_value,
zval* return_value);
int execute_unlink_array(const void* glide_client,
HashTable* keys_hash,
long* output_value,
zval* return_value);
int execute_strlen_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_setrange_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_getset_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_lcs_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* Time to live operations */
int execute_ttl_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pttl_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* Sorted set operations */
/* Hash operations */
int execute_brpoplpush_command(const void* glide_client,
const char* src,
size_t src_len,
const char* dst,
size_t dst_len,
zend_long timeout,
char** result,
size_t* result_len);
/* Object operations */
int execute_object_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* Unified command functions */
int execute_watch_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_unwatch_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_flushdb_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_flushall_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_time_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_scan_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_cluster_scan_command(const void* glide_client,
char** cursor,
const char* pattern,
size_t pattern_len,
long count,
int has_count,
const char* type,
size_t type_len,
int has_type,
zval* return_value);
int execute_sscan_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_copy_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_hscan_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pfadd_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pfcount_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pfmerge_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_client_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_rawcommand_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_dbsize_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_select_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_move_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_echo_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_bitop_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_getbit_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_setbit_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_bitcount_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_bitpos_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_touch_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_wait_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_config_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_function_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_multi_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pipeline_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_discard_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_exec_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_fcall_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_fcall_ro_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_dump_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_restore_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_expire_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_expireat_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pexpire_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pexpireat_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_persist_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_expiretime_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_pexpiretime_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_mset_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_msetnx_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_type_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_append_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_getrange_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_sort_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_sort_ro_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_mget_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_rename_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_renamenx_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_getdel_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_getex_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_incr_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_incrby_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_incrbyfloat_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_decr_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_decrby_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_mget_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_exists_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_touch_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
int execute_unlink_command(zval* object, int argc, zval* return_value, zend_class_entry* ce);
/* ====================================================================
* METHOD IMPLEMENTATION MACROS
* ==================================================================== */
#define ECHO_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, echo) { \
if (execute_echo_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define BITOP_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, bitop) { \
if (execute_bitop_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define GETBIT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, getBit) { \
if (execute_getbit_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SETBIT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, setBit) { \
if (execute_setbit_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define BITCOUNT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, bitcount) { \
if (execute_bitcount_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define BITPOS_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, bitpos) { \
if (execute_bitpos_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
/* DEL command needs special handling since it has different signature */
#define DEL_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, del) { \
if (execute_del_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
/* Additional unified macros for new converted commands */
#define SELECT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, select) { \
if (execute_select_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define GET_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, get) { \
if (execute_get_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define RANDOMKEY_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, randomKey) { \
if (execute_randomkey_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define STRLEN_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, strlen) { \
if (execute_strlen_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define TTL_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, ttl) { \
if (execute_ttl_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define PTTL_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, pttl) { \
if (execute_pttl_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define PING_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, ping) { \
if (execute_ping_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define INFO_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, info) { \
if (execute_info_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
/* Additional SET family macros */
#define SETEX_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, setex) { \
if (execute_setex_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define PSETEX_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, psetex) { \
if (execute_psetex_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SETNX_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, setnx) { \
if (execute_setnx_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SETRANGE_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, setRange) { \
if (execute_setrange_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define GETSET_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, getset) { \
if (execute_getset_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SET_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, set) { \
if (execute_set_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define LCS_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, lcs) { \
if (execute_lcs_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define WATCH_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, watch) { \
if (execute_watch_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define UNWATCH_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, unwatch) { \
if (execute_unwatch_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define FLUSHDB_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, flushDB) { \
if (execute_flushdb_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define FLUSHALL_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, flushAll) { \
if (execute_flushall_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define TIME_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, time) { \
if (execute_time_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SCAN_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, scan) { \
if (execute_scan_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SSCAN_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, sscan) { \
if (execute_sscan_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define COPY_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, copy) { \
if (execute_copy_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define HSCAN_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, hscan) { \
if (execute_hscan_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define PFADD_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, pfadd) { \
if (execute_pfadd_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define PFCOUNT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, pfcount) { \
if (execute_pfcount_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define PFMERGE_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, pfmerge) { \
if (execute_pfmerge_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define CLIENT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, client) { \
if (execute_client_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define RAWCOMMAND_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, rawcommand) { \
if (execute_rawcommand_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define DBSIZE_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, dbSize) { \
if (execute_dbsize_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define SELECT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, select) { \
if (execute_select_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define MOVE_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, move) { \
if (execute_move_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define DECRBY_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, decrBy) { \
if (execute_decrby_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define RENAME_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, rename) { \
if (execute_rename_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define RENAMENX_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, renameNx) { \
if (execute_renamenx_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define GETDEL_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, getDel) { \
if (execute_getdel_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define GETEX_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, getEx) { \
if (execute_getex_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define INCR_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, incr) { \
if (execute_incr_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define INCRBY_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, incrBy) { \
if (execute_incrby_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define INCRBYFLOAT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, incrByFloat) { \
if (execute_incrbyfloat_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define DECR_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, decr) { \
if (execute_decr_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define MGET_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, mget) { \
if (execute_mget_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define EXISTS_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, exists) { \
if (execute_exists_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define TOUCH_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, touch) { \
if (execute_touch_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define UNLINK_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, unlink) { \
if (execute_unlink_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define WAIT_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, wait) { \
if (execute_wait_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define CONFIG_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, config) { \
if (execute_config_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define FUNCTION_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, function) { \
if (execute_function_command(getThis(), \
ZEND_NUM_ARGS(), \
return_value, \
strcmp(#class_name, "ValkeyGlideCluster") == 0 \
? get_valkey_glide_cluster_ce() \
: get_valkey_glide_ce())) { \
return; \
} \
zval_dtor(return_value); \
RETURN_FALSE; \
}
#define MULTI_METHOD_IMPL(class_name) \
PHP_METHOD(class_name, multi) { \