Specify TTL when doing insert on a new record


I am trying to do an insert/upsert

$status = $db->increment($key, $bin, $init_or_increment_value);

I want to specify a TTL when it creates the object or at least fail when the record doesnt already exist, so that i can manually create it with the new TTL. What would be the best/most efficient way to do this?


Good catch. We already have an open ticket for extending the operate() method’s OPERATOR_TOUCH specification, which will be the way to do what you’re asking for. Expect it in one of the upcoming releases (for now, it is not yet available).

Thanks! Looking forward to it!

Please check out the new 3.3.16 release. It allows you to specify a TTL for the touch operation.

1 Like

Thanks! This is great!

Hi. This is implemented in release 3.4.3 using OPT_TTL, and can be done in operate(), append(), prepend(), increment() and removeBin().

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.