How to touch the records by udf if it LUT lies between specific date range

how to implement udf in a way that it will touch only those records those LUT lies between specific date range, I have a udf to touch record

function touch_rec(rec,sec)

local CITRUSLEAF_EPOCH_S=1262304000000

local server_lut = record.last_update_time(rec)

local lut =(server_lut+CITRUSLEAF_EPOCH_S)

local curtms=curt*1000

local ms=sec*1000

local rewindtime=curtms-ms

if sec==0 then

record.set_ttl(rec,-2)

aerospike:update(rec)

elseif lut >= rewindtime then

record.set_ttl(rec,-2)

aerospike:update(rec)

else

end

here i want to touch only those records those lut lies between my input starttime and endtime how to do that any help/suggestion

Hi digvijay, Do you have to use a UDF? It would seem to be possible to do this using a background scan with an Expression which would be simpler and more efficient. If you’re ok with this approach can you please repost your UDF as preformatted text so it’s easier to read and let me know which version of Aerospike you’re using and I’ll give you sample as to how you might do this.

@Tim_Faulkes Thanks for your quick concern, Yes, I have to use UDF and in previous post i have formatted udf Requirement is, suppose i have records with lut( 03-may-2023, 04-may-2023 and 05-may-2023) and I need to touch records of only 4-may-2023 and i don’t want to touch others dates records