Specify TTL when doing insert on a new record


#1

Hi

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?

Thanks!


#2

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).


#3

Thanks! Looking forward to it!


#4

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


#5

Thanks! This is great!


#6

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