This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
aerospike.php
5162 lines (4983 loc) · 210 KB
/
aerospike.php
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
<?php
/**
* Copyright 2013-2017 Aerospike, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @category Database
* @package Aerospike
* @author Robert Marks <[email protected]>
* @copyright Copyright 2013-2018 Aerospike, Inc.
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2
* @link https://www.aerospike.com/docs/client/php/
* @filesource
*/
/**
* The Aerospike client class
*
* The Aerospike config options for `php.ini`:
* ```php
* // The connection timeout in milliseconds.
* aerospike.connect_timeout = 1000;
* // The read operation timeout in milliseconds.
* aerospike.read_timeout = 1000;
* // The write operation timeout in milliseconds.
* aerospike.write_timeout = 1000;
* // Whether to send and store the record's (ns,set,key) data along with
* // its (unique identifier) digest. 0: digest, 1: send
* aerospike.key_policy = 0; // only digest
* // The unsupported type handler. 0: none, 1: PHP, 2: user-defined
* aerospike.serializer = 1; // php serializer
* // Path to the user-defined Lua function modules.
* aerospike.udf.lua_user_path = /usr/local/aerospike/usr-lua;
* // Indicates if shared memory should be used for cluster tending.
* // Recommended for multi-process cases such as FPM. { true, false }
* aerospike.shm.use = false;
* // Explicitly sets the shm key for this client to store shared-memory
* // cluster tending results in.
* aerospike.shm.key = 0xA8000000; // integer value
* // Shared memory maximum number of server nodes allowed. Leave a cushion so
* // new nodes can be added without needing a client restart.
* aerospike.shm.max_nodes = 16;
* // Shared memory maximum number of namespaces allowed. Leave a cushion for
* // new namespaces.
* aerospike.shm.max_namespaces = 8;
* // Take over shared memory cluster tending if the cluster hasn't been tended
* // by this threshold in seconds.
* aerospike.shm.takeover_threshold_sec = 30;
* // Control the batch protocol. 0: batch-index, 1: batch-direct
* aerospike.use_batch_direct = 0;
* // The client will compress records larger than this value in bytes for transport.
* aerospike.compression_threshold = 0;
* // Max size of the synchronous connection pool for each server node
* aerospike.max_threads = 300;
* // Number of threads stored in underlying thread pool that is used in
* // batch/scan/query commands. In ZTS builds, this is always 0.
* aerospike.thread_pool_size = 16;
* // When turning on the optional logging in the client, this is the path to the log file.
* aerospike.log_path = NULL;
* aerospike.log_level = NULL;
* aerospike.nesting_depth = 3;
*
* // session handler
* session.save_handler = aerospike; // to use the Aerospike session handler
* session.gc_maxlifetime = 1440; // the TTL of the record used to store the session in seconds
* session.save_path = NULL; // should follow the format ns|set|addr:port[,addr:port[,...]]. Ex: "test|sess|127.0.0.1:3000". The host info of just one cluster node is necessary
* ```
* @author Robert Marks <[email protected]>
*/
class Aerospike {
// Lifecycle and Connection Methods
/**
* Construct an Aerospike client object, and connect to the cluster defined
* in $config.
*
* Aerospike::isConnected() can be used to test whether the connection has
* succeeded. If a config or connection error has occured, Aerospike::error()
* and Aerospike::errorno() can be used to inspect it.
*
* ```php
* $config = [
* "hosts" => [
* ["addr" => "localhost", "port" => 3000]
* ],
* "shm" => []
* ];
* // Set a default policy for write and read operations
* $writeOpts = [Aerospike::OPT_POLICY_KEY => Aerospike::POLICY_KEY_SEND];
* $readOpts = [Aerospike::OPT_TOTAL_TIMEOUT => 150];
* $opts = [Aerospike::OPT_WRITE_DEFAULT_POL => $writeOpts, Aerospike::OPT_READ_DEFAULT_POL => $readOpts];
* $client = new Aerospike($config, true, $opts);
* if (!$client->isConnected()) {
* echo "Aerospike failed to connect[{$client->errorno()}]: {$client->error()}\n";
* exit(1);
* }
* ```
* @see Aerospike php.ini config parameters
* @link https://github.com/aerospike/aerospike-client-php/blob/master/doc/README.md#configuration-in-a-web-server-context Configuration in a Web Server Context
* @param array $config holds cluster connection and client config information
* * _hosts_ a **required** array of host pairs. One node or more (for failover)
* may be defined. Once a connection is established to the
* "seed" node, the client will retrieve the full list of nodes in
* the cluster, and manage its connections to them.
* * _addr_ hostname or IP of the node
* * _port_ the port of the node
* * _user_ **required** for the Enterprise Edition
* * _pass_ **required** for the Enterprise Edition
* * _shm_ optional. Shared-memory cluster tending is enabled if an array
* (even an empty one) is provided. Disabled by default.
* * _shm\_key_ explicitly sets the shm key for the cluster. It is
* otherwise implicitly evaluated per unique hostname, and can be
* inspected with shmKey(). (default: 0xA8000000)
* * _shm\_max\_nodes_ maximum number of nodes allowed. Pad so new nodes
* can be added without configuration changes (default: 16)
* * _shm\_max\_namespaces_ maximum number of namespaces allowed (default: 8)
* * _shm\_takeover\_threshold\_sec_ take over tending if the cluster
* hasn't been checked for this many seconds (default: 30)
* * _max\_threads_ (default: 300)
* * _thread\_pool\_size_ should be at least the number of nodes in the cluster (default: 16) In ZTS builds this is set to 0
* * _compression\_threshold_ client will compress records larger than this value for transport (default: 0)
* * _tender\_interval_ polling interval in milliseconds for cluster tender (default: 1000)
* * _cluster\_name_ if specified, only server nodes matching this name will be used when determining the cluster
* * _rack\_aware_ Boolean: Track server rack data. This field is useful when directing read commands to
* the server node that contains the key and exists on the same rack as the client.
* This serves to lower cloud provider costs when nodes are distributed across different
* racks/data centers.
* POLICY_REPLICA_PREFER_RACK must be set as the replica policy for reads and _rack\_id_ must be set toenable this functionality.
* (Default: false)
* * _rack\_id_ Integer. Rack where this client instance resides.
*
* _rack\_aware_, POLICY_REPLICA_PREFER_RACK and server rack configuration must also be
* set to enable this functionality.
*
* Default: 0
* * Aerospike::OPT_TLS_CONFIG an array of TLS setup parameters whose keys include
* * * Aerospike::OPT_TLS_ENABLE boolean Whether or not to enable TLS.
* * * Aerospike::OPT_OPT_TLS_CAFILE
* * * Aerospike::OPT_TLS_CAPATH
* * * Aerospike::OPT_TLS_PROTOCOLS
* * * Aerospike::OPT_TLS_CIPHER_SUITE
* * * Aerospike::OPT_TLS_CRL_CHECK
* * * Aerospike::OPT_TLS_CRL_CHECK_ALL
* * * Aerospike::OPT_TLS_CERT_BLACKLIST
* * * Aerospike::OPT_TLS_LOG_SESSION_INFO
* * * Aerospike::OPT_TLS_KEYFILE
* * * Aerospike::OPT_TLS_CERTFILE
* @param bool $persistent_connection In a multiprocess context, such as a
* web server, the client should be configured to use
* persistent connections. This allows for reduced overhead,
* saving on discovery of the cluster topology, fetching its partition
* map, and on opening connections to the nodes.
* @param array $options An optional client config array whose keys include
* * Aerospike::OPT_CONNECT_TIMEOUT
* * Aerospike::OPT_READ_TIMEOUT
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_EXISTS
* * Aerospike::OPT_SERIALIZER
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::OPT_POLICY_REPLICA
* * Aerospike::OPT_POLICY_READ_MODE_AP
* * Aerospike::OPT_POLICY_READ_MODE_SC
* * Aerospike::USE_SERVICES_ALTERNATE
* * Aerospike::OPT_READ_DEFAULT_POL An array of default policies for read operations.
* * Aerospike::OPT_WRITE_DEFAULT_POL An array of default policies for write operations.
* * AEROSPIKE::OPT_REMOVE_DEFAULT_POL An array of default policies for remove operations.
* * Aerospike::OPT_BATCH_DEFAULT_POL An array of default policies for batch operations.
* * Aerospike::OPT_OPERATE_DEFAULT_POL An array of default policies for operate operations.
* * Aerospike::OPT_QUERY_DEFAULT_POL An array of default policies for query operations.
* * Aerospike::OPT_SCAN_DEFAULT_POL An array of default policies for scan operations.
* * Aerospike::OPT_APPLY_DEFAULT_POL An array of default policies for apply operations.
* @see Aerospike::OPT_CONNECT_TIMEOUT Aerospike::OPT_CONNECT_TIMEOUT options
* @see Aerospike::OPT_READ_TIMEOUT Aerospike::OPT_READ_TIMEOUT options
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_EXISTS Aerospike::OPT_POLICY_EXISTS options
* @see Aerospike::OPT_SERIALIZER Aerospike::OPT_SERIALIZER options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::OPT_POLICY_REPLICA Aerospike::OPT_POLICY_REPLICA options
* @see Aerospike::OPT_POLICY_READ_MODE_AP Aerospike::OPT_POLICY_READ_MODE_AP options
* @see Aerospike::OPT_POLICY_READ_MODE_SC Aerospike::OPT_POLICY_READ_MODE_SC options
* @see Aerospike::isConnected() isConnected()
* @see Aerospike::error() error()
* @see Aerospike::errorno() errorno()
* @return void
*/
public function __construct(array $config, bool $persistent_connection = true, array $options = []) {}
/**
* Disconnect from the Aerospike cluster and clean up resources.
*
* No need to ever call this method explicilty.
* @return void
*/
public function __destruct() {}
/**
* Test whether the client is connected to the cluster.
*
* If a connection error has occured, Aerospike::error() and Aerospike::errorno()
* can be used to inspect it.
* ```php
* if (!$client->isConnected()) {
* echo "Aerospike failed to connect[{$client->errorno()}]: {$client->error()}\n";
* exit(1);
* }
* ```
* @see Aerospike::error() error()
* @see Aerospike::errorno() errorno()
* @return bool
*/
public function isConnected() {}
/**
* Disconnect the client from all the cluster nodes.
*
* This method should be explicitly called when using non-persistent connections.
* @see Aerospike::isConnected()
* @see Aerospike::reconnect()
* @return void
*/
public function close() {}
/**
* Reconnect the client to the cluster nodes.
*
* Aerospike::isConnected() can be used to test whether the re-connection
* succeded. If a connection error occured Aerospike::error() and
* Aerospike::errorno() can be used to inspect it.
* ```php
* $client = new Aerospike($config, false);
* $client->close();
* $client->reconnect();
* if (!$client->isConnected()) {
* echo "Aerospike failed to connect[{$client->errorno()}]: {$client->error()}\n";
* exit(1);
* }
* ```
* @see Aerospike::error() error()
* @see Aerospike::errorno() errorno()
* @return void
*/
public function reconnect() {}
/**
* Expose the shared memory key used by shared-memory cluster tending
*
* If shm cluster tending is enabled, Aerospike::shmKey will return the
* value of the shm key being used by the client. If it was set explicitly
* under the client's shm config parameter, or through the global
* `aerospike.shm.key` we expect to see that value. Otherwise the implicit
* value generated by the client will be returned
* @return int|null null if not enabled
*/
public function shmKey() {}
/**
* Return the error message associated with the last operation.
*
* If the operation was successful the return value should be an empty string.
* ```php
* $client = new Aerospike($config, false);
* if (!$client->isConnected()) {
* echo "{$client->error()} [{$client->errorno()}]";
* exit(1);
* }
* ```
* On connection error would show:
* ```
* Unable to connect to server [-1]
* ```
* @see Aerospike::OK Error Codes
* @return string
*/
public function error() {}
/**
* Return the error code associated with the last operation.
* If the operation was successful the return value should be 0 (Aerospike::OK)
* @see Aerospike::OK Error Codes
* @return int
*/
public function errorno() {}
// Key-Value Methods.
/**
* Return an array that represents the record's key.
*
* This value can be passed as the $key arguement required by other
* key-value methods.
*
* In Aerospike, a record is identified by the tuple (namespace, set,
* primary key), or by the digest which results from hashing this tuple
* through RIPEMD-160.
*
* ** Initializing a key **
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* var_dump($key);
* ```
*
* ```bash
*array(3) {
* ["ns"]=>
* string(4) "test"
* ["set"]=>
* string(5) "users"
* ["key"]=>
* int(1234)
*}
* ```
*
* ** Setting a digest **
*
* ```php
* $base64_encoded_digest = '7EV9CpdMSNVoWn76A9E33Iu95+M=';
* $digest = base64_decode($base64_encoded_digest);
* $key = $client->initKey("test", "users", $digest, true);
* var_dump($key);
* ```
*
* ```bash
*array(3) {
* ["ns"]=>
* string(4) "test"
* ["set"]=>
* string(5) "users"
* ["digest"]=>
* string(20) "?E}
*?LH?hZ~??7Ü‹???"
*}
* ```
*
* @link https://github.com/aerospike/aerospike-client-php/blob/master/doc/README.md#configuration-in-a-web-server-context Configuration in a Web Server Context
* @param string $ns the namespace
* @param string $set the set within the given namespace
* @param int|string $pk The primary key in the application, or the RIPEMD-160 digest of the (namespce, set, primary-key) tuple
* @param bool $is_digest True if the *$pk* argument is a digest
* @return array
* @see Aerospike::getKeyDigest() getKeyDigest()
*/
public function initKey (string $ns, string $set, $pk, bool $is_digest = false) {}
/**
* Return the digest of hashing the (namespace, set, primary-key) tuple
* with RIPEMD-160.
*
* The digest uniquely identifies the record in the cluster, and is used to
* calculate a partition ID. Using the partition ID, the client can identify
* the node holding the record's master partition or replica partition(s) by
* looking it up against the cluster's partition map.
*
* ```php
* $digest = $client->getKeyDigest("test", "users", 1);
* $key = $client->initKey("test", "users", $digest, true);
* var_dump($digest, $key);
* ```
*
* ```bash
* string(20) "9!?@%??;???Wp?'??Ag"
* array(3) {
* ["ns"]=>
* string(4) "test"
* ["set"]=>
* string(5) "users"
* ["digest"]=>
* string(20) "9!?@%??;???Wp?'??Ag"
* }
* ```
*
* @link https://github.com/aerospike/aerospike-client-php/blob/master/doc/README.md#configuration-in-a-web-server-context Configuration in a Web Server Context
* @param string $ns the namespace
* @param string $set the set within the given namespace
* @param int|string $pk The primary key in the application
* @return string
* @see Aerospike::initKey() initKey()
*/
public function getKeyDigest (string $ns, string $set, $pk ) {}
/**
* Write a record identified by the $key with $bins, an array of bin-name => bin-value pairs.
*
* By default Aerospike::put() behaves in a set-and-replace mode, similar to
* how new keys are added to an array, or the value of existing ones is overwritten.
* This behavior can be modified using the *$options* parameter.
*
* **Note:** a binary-string which includes a null-byte will get truncated
* at the position of the **\0** character if it is not wrapped. For more
* information and the workaround see 'Handling Unsupported Types'.
*
* **Example #1 Aerospike::put() default behavior example**
* ```php
* $key = $client->initKey("test", "users", 1234);
* $bins = ["email" => "[email protected]", "name" => "Hey There"];
* // will ensure a record exists at the given key with the specified bins
* $status = $client->put($key, $bins);
* if ($status == Aerospike::OK) {
* echo "Record written.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
*
* // Updating the record
* $bins = ["name" => "You There", "age" => 33];
* // will update the name bin, and create a new 'age' bin
* $status = $client->put($key, $bins);
* if ($status == Aerospike::OK) {
* echo "Record updated.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* Record written.
* Record updated.
* ```
*
* **Example #2 Fail unless the put explicitly creates a new record**
* ```php
*
* // This time we expect an error, due to the record already existing (assuming we
* // ran Example #1)
* $status = $client->put($key, $bins, 0, [Aerospike::OPT_POLICY_EXISTS => Aerospike::POLICY_EXISTS_CREATE]);
*
* if ($status == Aerospike::OK) {
* echo "Record written.\n";
* } elseif ($status == Aerospike::ERR_RECORD_EXISTS) {
* echo "The Aerospike server already has a record with the given key.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* The Aerospike cluster already has a record with the given key.
* ```
*
* **Example #3 Fail if the record has been written since it was last read
* (CAS)**
* ```php
* // Get the record metadata and note its generation
* $client->exists($key, $metadata);
* $gen = $metadata['generation'];
* $gen_policy = [Aerospike::POLICY_GEN_EQ, $gen];
* $res = $client->put($key, $bins, 0, [Aerospike::OPT_POLICY_GEN => $gen_policy]);
*
* if ($res == Aerospike::OK) {
* echo "Record written.\n";
* } elseif ($res == Aerospike::ERR_RECORD_GENERATION) {
* echo "The record has been written since we last read it.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ?>
* ```
* ```
* The record has been written since we last read it.
* ```
*
* **Example #4 Handling binary strings**
* ```php
* $str = 'Glagnar\'s Human Rinds, "It\'s a bunch\'a munch\'a crunch\'a human!';
* $deflated = new \Aerospike\Bytes(gzdeflate($str));
* $wrapped = new \Aerospike\Bytes("trunc\0ated");
*
* $key = $client->initKey('test', 'demo', 'wrapped-bytes');
* $status = $client->put($key, ['unwrapped'=>"trunc\0ated", 'wrapped'=> $wrapped, 'deflated' => $deflated]);
* if ($status !== Aerospike::OK) {
* die($client->error());
* }
* $client->get($key, $record);
* $wrapped = \Aerospike\Bytes::unwrap($record['bins']['wrapped']);
* $deflated = $record['bins']['deflated'];
* $inflated = gzinflate($deflated->s);
* echo "$inflated\n";
* echo "wrapped binary-string: ";
* var_dump($wrapped);
* $unwrapped = $record['bins']['unwrapped'];
* echo "The binary-string that was given to put() without a wrapper: $unwrapped\n";
* ```
* ```
* Glagnar's Human Rinds, "It's a bunch'a munch'a crunch'a human!
* wrapped binary-string: string(10) "truncated"
* The binary-string that was given to put() without a wrapper: trunc
* ```
* @link https://www.aerospike.com/docs/architecture/data-model.html Aerospike Data Model
* @link https://www.aerospike.com/docs/guide/kvs.html Key-Value Store
* @link https://github.com/aerospike/aerospike-client-php/blob/master/doc/README.md#handling-unsupported-types Handling Unsupported Types
* @link https://www.aerospike.com/docs/client/c/usage/kvs/write.html#change-record-time-to-live-ttl Time-to-live
* @link https://www.aerospike.com/docs/guide/glossary.html Glossary
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param array $bins The array of bin names and values to write. **Bin names cannot be longer than 14 characters.** Binary data containing the null byte (**\0**) may get truncated. See 'Handling Unsupported Types' for more details and a workaround
* @param int $ttl The record's time-to-live in seconds
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_SERIALIZER
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_GEN
* * Aerospike::OPT_POLICY_EXISTS
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::COMPRESSION_THRESHOLD
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_SERIALIZER Aerospike::OPT_SERIALIZER options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_GEN Aerospike::OPT_POLICY_GEN options
* @see Aerospike::OPT_POLICY_EXISTS Aerospike::OPT_POLICY_EXISTS options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::COMPRESSION_THRESHOLD
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OK Aerospike::OK and error status codes
* @see Aerospike::error() error()
* @see Aerospike::errorno() errorno()
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function put(array $key, array $bins, int $ttl = 0, array $options = []) {}
/**
* Read a record with a given key, and store it in $record
*
* The bins returned in *$record* can be filtered by passing a *$select*
* array of bin names. Non-existent bins will appear in the *$record* with a `NULL` value.
*
* **Example #1 Aerospike::get() default behavior example**
* ```php
* $key = $client->initKey("test", "users", 1234);
* $status = $client->get($key, $record);
* if ($status == Aerospike::OK) {
* var_dump($record);
* } elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
* echo "A user with key ". $key['key']. " does not exist in the database\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* array(3) {
* ["key"]=>
* array(4) {
* ["digest"]=>
* string(40) "436a3b9fcafb96d12844ab1377c0ff0d7a0b70cc"
* ["namespace"]=>
* NULL
* ["set"]=>
* NULL
* ["key"]=>
* NULL
* }
* ["metadata"]=>
* array(2) {
* ["generation"]=>
* int(3)
* ["ttl"]=>
* int(12345)
* }
* ["bins"]=>
* array(3) {
* ["email"]=>
* string(9) "[email protected]"
* ["name"]=>
* string(9) "You There"
* ["age"]=>
* int(33)
* }
* }
* ```
* **Example #2 get the record with filtered bins**
* ```php
* // assuming this follows Example #1, getting a filtered record
* $filter = ["email", "manager"];
* unset($record);
* $status = $client->get($key, $record, $filter);
* if ($status == Aerospike::OK) {
* var_dump($record);
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* array(3) {
* ["key"]=>
* array(4) {
* ["digest"]=>
* string(40) "436a3b9fcafb96d12844ab1377c0ff0d7a0b70cc"
* ["namespace"]=>
* NULL
* ["set"]=>
* NULL
* ["key"]=>
* NULL
* }
* ["metadata"]=>
* array(2) {
* ["generation"]=>
* int(3)
* ["ttl"]=>
* int(12344)
* }
* ["bins"]=>
* array(2) {
* ["email"]=>
* string(15) "[email protected]"
* ["manager"]=>
* NULL
* }
* }
* ```
* @link https://www.aerospike.com/docs/architecture/data-model.html Aerospike Data Model
* @link https://www.aerospike.com/docs/guide/kvs.html Key-Value Store
* @link https://www.aerospike.com/docs/guide/glossary.html Glossary
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param array $record a reference to a variable which will contain the retrieved record of `['key', metadata', 'bins]` with the structure:
* ```
* Array:
* key => Array
* ns => namespace
* set => set name
* key => primary-key, present if written with POLICY_KEY_SEND
* digest => the record's RIPEMD-160 digest, always present
* metadata => Array
* ttl => time in seconds until the record expires
* generation => the number of times the record has been written
* bins => Array of bin-name => bin-value pairs
* ```
* @param array $select only these bins out of the record (optional)
* @param array $options an optional array of read policy options, whose keys include
* * Aerospike::OPT_READ_TIMEOUT
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_DESERIALIZE
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* * Aerospike::OPT_POLICY_REPLICA
* * Aerospike::OPT_POLICY_READ_MODE_AP
* * Aerospike::OPT_POLICY_READ_MODE_SC
* @see Aerospike::OPT_READ_TIMEOUT Aerospike::OPT_READ_TIMEOUT options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_DESERIALIZE Aerospike::OPT_DESERIALIZE option
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OPT_POLICY_REPLICA Aerospike::OPT_POLICY_REPLICA options
* @see Aerospike::OPT_POLICY_READ_MODE_AP Aerospike::OPT_POLICY_READ_MODE_AP options
* @see Aerospike::OPT_POLICY_READ_MODE_SC Aerospike::OPT_POLICY_READ_MODE_SC options
* @see Aerospike::OK Aerospike::OK and error status codes
* @see Aerospike::error() error()
* @see Aerospike::errorno() errorno()
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function get(array $key, &$record, array $select = null, array $options = []) {}
/**
* Get the metadata of a record with a given key, and store it in $metadata
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* $status = $client->exists($key, $metadata);
* if ($status == Aerospike::OK) {
* var_dump($metadata);
* } elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
* echo "A user with key ". $key['key']. " does not exist in the database\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* array(2) {
* ["generation"]=>
* int(4)
* ["ttl"]=>
* int(1337)
* }
* ```
* **or**
* ```
* A user with key 1234 does not exist in the database.
* ```
* @link https://www.aerospike.com/docs/guide/glossary.html Glossary
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param array $metadata a reference to a variable which will be filled with an array of `['ttl', 'generation']` values
* @param array $options an optional array of read policy options, whose keys include
* * Aerospike::OPT_READ_TIMEOUT
* * Aerospike::OPT_DESERIALIZE
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_REPLICA
* * Aerospike::OPT_POLICY_READ_MODE_AP
* * Aerospike::OPT_POLICY_READ_MODE_SC
* @see Aerospike::OPT_READ_TIMEOUT Aerospike::OPT_READ_TIMEOUT options
* @see Aerospike::OPT_DESERIALIZE Aerospike::OPT_DESERIALIZE option
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_REPLICA Aerospike::OPT_POLICY_REPLICA options
* @see Aerospike::OPT_POLICY_READ_MODE_AP Aerospike::OPT_POLICY_READ_MODE_AP options
* @see Aerospike::OPT_POLICY_READ_MODE_SC Aerospike::OPT_POLICY_READ_MODE_SC options
* @see Aerospike::OK Aerospike::OK and error status codes
* @see Aerospike::error() error()
* @see Aerospike::errorno() errorno()
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function exists(array $key, &$metadata, array $options = []) {}
/**
* Touch the record identified by the $key, resetting its time-to-live.
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* $status = $client->touch($key, 120);
* if ($status == Aerospike::OK) {
* echo "Added 120 seconds to the record's expiration.\n"
* } elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
* echo "A user with key ". $key['key']. " does not exist in the database\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* Added 120 seconds to the record's expiration.
* ```
* **or**
* ```
* A user with key 1234 does not exist in the database.
* ```
* @link https://www.aerospike.com/docs/client/c/usage/kvs/write.html#change-record-time-to-live-ttl Time-to-live
* @link https://www.aerospike.com/docs/guide/FAQ.html FAQ
* @link https://discuss.aerospike.com/t/records-ttl-and-evictions/737 Record TTL and Evictions
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param int $ttl The record's time-to-live in seconds
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_GEN
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::OPT_DESERIALIZE
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_GEN Aerospike::OPT_POLICY_GEN options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::OPT_DESERIALIZE Aerospike::OPT_DESERIALIZE option
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OK Aerospike::OK and error status codes
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function touch(array $key, int $ttl = 0, array $options =[]) {}
/**
* Remove the record identified by the $key.
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* $status = $client->remove($key);
* if ($status == Aerospike::OK) {
* echo "Record removed.\n";
* } elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
* echo "A user with key ". $key['key']. " does not exist in the database\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* ```
* Record removed.
* ```
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_POLICY_GEN
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::OPT_POLICY_DURABLE_DELETE
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_POLICY_GEN Aerospike::OPT_POLICY_GEN options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::OPT_POLICY_DURABLE_DELETE Aerospike::OPT_POLICY_DURABLE_DELETE options
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OK Aerospike::OK and error status codes
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function remove(array $key, array $options = []) {}
/**
* Remove $bins from the record identified by the $key.
*
* ```php
* $key = ["ns" => "test", "set" => "users", "key" => 1234];
* $options = array(Aerospike::OPT_TTL => 3600);
* $status = $client->removeBin($key, ["age"], $options);
* if ($status == Aerospike::OK) {
* echo "Removed bin 'age' from the record.\n";
* } elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
* echo "The database has no record with the given key.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param array $bins A list of bin names to remove
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_GEN
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::COMPRESSION_THRESHOLD
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_GEN Aerospike::OPT_POLICY_GEN options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::COMPRESSION_THRESHOLD
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OK Aerospike::OK and error status codes
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function removeBin(array $key, array $bins , array $options = []) {}
/**
* Remove all the records from a namespace or set
*
* Remove records in a specified namespace/set efficiently. This method is
* many orders of magnitude faster than deleting records one at a time.
* **Note:** works with Aerospike Server versions >= 3.12
* See {@link https://www.aerospike.com/docs/reference/info#truncate Truncate command information}
*
* This asynchronous server call may return before the truncation is complete.
* The user can still write new records after the server returns because new
* records will have last update times greater than the truncate cutoff
* (set at the time of truncate call).
*
* The truncate command does not durably delete records in the Community Edition.
* The Enterprise Edition provides durability through the truncate command.
*
* ```php
* $secondsInDay = 24 * 60 * 60;
*
* // Multiply by 10 ^ 9 to get nanoseconds
* $yesterday = 1000000000 * (time() - $secondsInDay);
*
* // Remove all records in test/truncateSet updated before 24 hours ago
* $status = $client->truncate("test", "demoSet", $yesterday);
*
* // Truncate all records in test, regardless of update time
* $status = $client->truncate("test", null, 0);
* ```
* @version 3.12 Requires server >= 3.12
* @param string $ns the namespace
* @param string $set the set within the given namespace
* @param int $nanos cutoff threshold indicating that records
* last updated before the threshold will be removed. Units are in
* nanoseconds since unix epoch (1970-01-01 00:00:00). A value of 0
* indicates that all records in the set should be truncated
* regardless of update time. The value must not be in the future.
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function truncate(string $ns, string $set, int $nanos, array $options = []) {}
/**
* Increment the value of $bin in the record identified by the $key by an
* $offset.
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* $options = [Aerospike::OPT_TTL => 7200];
* $status = $client->increment($key, 'pto', -4, $options);
* if ($status == Aerospike::OK) {
* echo "Decremented four vacation days from the user's PTO balance.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param string $bin The name of the bin to increment
* @param int|float $offset The value by which to increment the bin
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_TTL
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_GEN
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_TTL Aerospike::OPT_TTL options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_GEN Aerospike::OPT_POLICY_GEN options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OK Aerospike::OK and error status codes
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function increment(array $key, string $bin, $offset, array $options = []) {}
/**
* Append a string $value to the one already in $bin, in the record identified by the $key.
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* $options = [Aerospike::OPT_TTL => 3600];
* $status = $client->append($key, 'name', ' Ph.D.', $options);
* if ($status == Aerospike::OK) {
* echo "Added the Ph.D. suffix to the user.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```
* @param array $key The key identifying the record. An array with keys `['ns','set','key']` or `['ns','set','digest']`
* @param string $bin The name of the bin
* @param string $value The string value to append to the bin
* @param array $options an optional array of write policy options, whose keys include
* * Aerospike::OPT_WRITE_TIMEOUT
* * Aerospike::OPT_TTL
* * Aerospike::OPT_POLICY_KEY
* * Aerospike::OPT_POLICY_GEN
* * Aerospike::OPT_POLICY_COMMIT_LEVEL
* * Aerospike::OPT_DESERIALIZE
* * Aerospike::OPT_SLEEP_BETWEEN_RETRIES
* * Aerospike::OPT_TOTAL_TIMEOUT
* * Aerospike::OPT_MAX_RETRIES
* * Aerospike::OPT_SOCKET_TIMEOUT
* @see Aerospike::OPT_WRITE_TIMEOUT Aerospike::OPT_WRITE_TIMEOUT options
* @see Aerospike::OPT_TTL Aerospike::OPT_TTL options
* @see Aerospike::OPT_POLICY_KEY Aerospike::OPT_POLICY_KEY options
* @see Aerospike::OPT_POLICY_GEN Aerospike::OPT_POLICY_GEN options
* @see Aerospike::OPT_POLICY_COMMIT_LEVEL Aerospike::OPT_POLICY_COMMIT_LEVEL options
* @see Aerospike::OPT_DESERIALIZE Aerospike::OPT_DESERIALIZE option
* @see Aerospike::OPT_SLEEP_BETWEEN_RETRIES Aerospike::OPT_SLEEP_BETWEEN_RETRIES options
* @see Aerospike::OPT_TOTAL_TIMEOUT Aerospike::OPT_TOTAL_TIMEOUT options
* @see Aerospike::OPT_SOCKET_TIMEOUT Aerospike::OPT_SOCKET_TIMEOUT options
* @see Aerospike::MAX_RETRIES Aerospike::MAX_RETRIES options
* @see Aerospike::OK Aerospike::OK and error status codes
* @return int The status code of the operation. Compare to the Aerospike class status constants.
*/
public function append(array $key, string $bin, string $value, array $options = []) {}
/**
* Prepend a string $value to the one already in $bin, in the record identified by the $key.
*
* ```php
* $key = $client->initKey("test", "users", 1234);
* $options = [Aerospike::OPT_TTL => 3600];
* $status = $client->prepend($key, 'name', '*', $options);
* if ($status == Aerospike::OK) {
* echo "Starred the user.\n";
* } else {
* echo "[{$client->errorno()}] ".$client->error();
* }
* ```