node.js - How to set ttl for aerospike record ttl through NodeJS Client -


i using nodejs client aerospike, , trying set ttl record, below code same.

insert(key, value) {     return new promise(function (resolve, reject) {         aerospike.put(key, value, function (err) {             if (err.code !== aerospikestatus.aerospike_ok) {                 reject("failed insert in secondary storage");             }             else {                 resolve(true);             }         });     }); } 

i following official documentation, unable find way set ttl through nodejs client. happen know how same?

(http://www.aerospike.com/docs/client/nodejs/usage/kvs/write.html)

actually, there 4 parameters of put function, (key, record, metadata, policy).
can see example here. following simple code show how set ttl:

  var key = new aerospike.key(ns, set, "ask")    var rec = {     as_bin: 'bin-content'   }    var meta = {       ttl: 1000   }    var policy = {     key: aerospike.policy.key.send   }    client.put(key, rec, meta, policy, function (error) {     if (error) {         console.log('error: %s', error.message)     } else {       console.log('record written database successfully.')     }   }) 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -