Undefined class constant 'OPT_TTL'


#1

Hi,

I’m having a strange message when trying to do this:

$status = $client->append($key, $bin_name, $string_to_append, [Aerospike::OPT_TTL => $ttl]);

Which is: Fatal error: Undefined class constant ‘OPT_TTL’ in /path/MyClass.class.php on line 285

I don’t have any problem with other constants, just this one… I’m using the PHP client 3.4.10, and the constant is visibly defined in Aerospike’s files (I checked the aerospike_policy.h file to be sure, and it’s in there).

Thanks in advance.


#2

So I thought “Hey, maybe it’s just an issue with the PHP client, and Aerospike works just fine.” (both are up to date, btw), so I tried to replace the Aerospike::OPT_TTL call by its value “OPT_TTL”, and not only it doesn’t work, but the status returned is -2…

A code which, according to this documentation: http://www.aerospike.com/docs/dev_reference/error_codes.html doesn’t exist…


#3

That page should probably have mentioned that positive error codes come from the server and negative error codes come from the client.

Since PHP wraps the C client, this should be the list:

In this case -2 maps to “Invalid client API parameter.”


#4

Thank you for your reply.

Well, that answers at least 1 question, even though it doesn’t solve the problem. In the meantime, I have replaced my “append” call with a “put” call, which includes a ttl parameter that works.

It’s a lot costlier in terms of resources, though…