aerospike-community / aerospike-client-php

Aerospike client for PHP7
Apache License 2.0
29 stars 28 forks source link

Adding use_services-alternate parameter to php-client #57

Closed zekena closed 4 years ago

zekena commented 4 years ago

This parameter exists in the c client but it's not available by default in the php client this pull request will make it work by adding it to the options array that can be specified inside the config array like the following example:

$config = [
    "hosts" => [
           ['addr' => '192.168.57.101', 'port' => 3000]],
    "options" => [
          // Flag to signify if "services-alternate" should be used instead of "services" Default: false
      Aerospike::USE_SERVICES_ALTERNATE => true
        ],
];
$db = new Aerospike($config);

// records are identified as a (namespace, set, primary-key) tuple
$key = $db->initKey("infosphere", "characters", 1234);

// the record and its bins are created and updated similar to an array
$put_vals = [ "name" => "Scruffy", "Occupation" => "The Janitor" ];
$db->put($key, $put_vals);

// record bins can hold complex types such as arrays
$update_vals = [
  "quotes" => [
    "I'm Scruffy. The janitor.",
    "I'm on break.",
    "Scruffy's gonna die like he lived."]];
$db->put($key, $update_vals);

// read selected bins from a record
$db->get($key, $record, ["name", "quotes"]);

$db->close();
arrowplum commented 4 years ago

Hey @zekena why did you close this one?

arrowplum commented 4 years ago

Ahh I see in the first sentence of https://github.com/aerospike/aerospike-client-php/pull/59. Still though it would have been good to just keep this pull request going rather than closing and creating a new one at least just to keep track of the changes etc.

zekena commented 4 years ago

Ahh I see in the first sentence of #59. Still though it would have been good to just keep this pull request going rather than closing and creating a new one at least just to keep track of the changes etc.

I made some commits by mistake that shouldn't have been done with testing the implementation and I don't think it's good to be included inside the repo that's why I created a new PR.