How to set ttl of as_record when read


In file “as_record.h”, it says “Note that the TTL value will be employed ONLY on write/update calls.”

But I need to reset record’ ttl when read it too. I have two options now :

  1. Do a read-operation and then do another update-operation

  2. Build a UDF function to read and reset ttl

Is there a simpler way to match my application?


Another option is to use the aerospike_key_operate() function, building up two operators, “touch” and “read”.


and example:


Thanks very much.

It works.