I’m new to Aerospike. We are using Aerospike with Spark (Java) for our system.
I want to set TTL for a dataframe everytime the data is written to Aerospike. However, I could not find a way to do that even from document or Internet.
My current write syntax:
networkDs.write()
.mode(SaveMode.Overwrite)
.format("com.aerospike.spark.sql")
.option("aerospike.set", Const.AEROSPIKE_SET)
.option("aerospike.updateByKey", "id")
.save();
Can somebody tell me how to do that?
Thanks a lot.
I'm not sure that I understand your question well but to use TTL while saving with aerospike
, you should store it in a column in the DataSet
/DataFrame
before it's saved.
Note: Time to live (TTL) can be set individually on each record.
To enable updates to TTL, and additional option is specified:
option("aerospike.ttlColumn", "expiry")
This means that the TTL is your column expiry
.
I hope this helps.
For further information, I advice you to look at the aerospike
tutorial documentation.